SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Zealot ant1832's Avatar
    Join Date
    Apr 2002
    Location
    Tucson, AZ
    Posts
    176
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    I have my rollover images preloaded on load, but still getting undefined errors.

    If I click on one of the navigation buttons on my site and leave my arrow there, IE tells me the variable name for that button is undefined. If I click on the button and move my arrow away while the page loads i get no error. Then I can move it back and still I have no errors.

    Its as though the load function is not being read before I call for that variable further down the page. I hope this makes sense.

    To see what I'm talking about just go to http://www.dkdesignco.com/v2/index.html

    Now hover over the home button and notice that there are no errors. Now click on the home button and leave your arrow over it. Now there is an error that home_on is undefined. But home_on should have already been defined before the page loaded, so whats going on?

    *please excuse the site...its still under development.
    Anthony

  2. #2
    SitePoint Member Kalirion's Avatar
    Join Date
    Sep 2003
    Location
    Reston, VA
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I know what is happening, though I'm no expert and I could be wrong.

    your load() function is only run after the entire body has finished loading. This means that if the onmouseout and onmouseover events fire before the body has finished loading, you get your errors. To fix this, you should assign event handlers inside the load() function, instead of the body.


Bookmarks

Posting Permissions

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