Preface: This was for a class assignment, but it has already been submitted. I couldn't ever get this thing to work so I was hoping someone could help. What's supposed to happen is that every three seconds a new image should show up in the gallery, then turn off when someone clicks an image. What happens instead is nothing... when I run Firebug I get a notice that everything involved with the var slideShow is coming back null. I have no idea why that's happening. Anyone here able to help?
HTML
Javascript
[SIGPIC][/SIGPIC]
When I was a little kid, I always pretended I was the hero,' Skip said.
'Fuck yeah, me too. What little kid ever pretended to be part of the lynch-mob?'
Posts
how would I go about getting the DOM to load while still keeping the variable? I have to call to it later in the script.
If you understand the why, Barrakketh gave the how to work around it.
What you do is no javascript outside the functions except for a callback. Wait for the DOM to be loaded, then you perform this callback which does the "global" stuff you wanted to do in the first place.
How you wait for the DOM and then make the callback is browser specific, which might be the DOMContentLoaded as mentioned. Usually you'll want to use jQuery (or similar) and its $.ready() binding.