CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002
    Location
    Sweden
    Posts
    136

    JavaScript: Object expected

    A common error, since it's so damned general that noone understands what it's pointing at. ;)

    Well. I've got myself a function in an external .js file.
    Code:
    function swapImage(imgID, imgFile) {
    	document.images[imgID].src = '/newdesign/images/menubuttons/' + imgFile;
    }
    Simple as can be, right? Right.

    Then, naturally, I've got an onMouseOver on a link that goes:
    Code:
    <a href="" onMouseOver="swapImage('imgHome','home_down.gif')"><img name="imgHome" src="home.gif"></a>
    I can't for the life of me see anything wrong. Am I stupid? Is javascript stupid? Is the answer to the question about life, the universe and everything not 42?
    Captain Obvious

    Documentation is your friend

  2. #2
    Join Date
    Jun 2002
    Location
    Sweden
    Posts
    136
    Never mind. ^^

    I was making an error in a completely different location that mungled the relative paths to the external .js. How stupid of me.
    Captain Obvious

    Documentation is your friend

  3. #3
    Join Date
    Apr 2003
    Location
    New York
    Posts
    1
    In general, use Mozilla/Netscape javascript console to get more meaningful error messages. Just type javascript: in the address bar.

  4. #4
    Join Date
    Jun 2002
    Location
    Sweden
    Posts
    136
    It wasn't even a javascript error, so I doubt that would help. But thanks.
    Captain Obvious

    Documentation is your friend

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured