"Richard Cornford" <Richard@litotes.demon.co.uk> wrote in message
news:bnup60$587$1$8300dec7@news.demon.co.uk...[color=blue]
> "TheKeith" <no@spam.com> wrote in message
> news:UYmdnWvXUZ7vNzyiRVn-hg@giganews.com...[color=green]
> >I just realizes it works in opera, but is also kind of messed up
> >in mozilla. I don't understand why this isn't running smoothly.
> >I've been staring at the script for the last half-hour, but I'm
> >just stumped.[/color]
>
> An observation; you have placed an onload handler on the IMG element in
> the HTML that calls the pic_cycler function and sets off the images
> swapping by having the cycler function called by setInterval. However,
> when the SRC of the IMG element is changed and a new image loads isn't
> that going to re-trigger the onload handler and re-call pic_cycler,
> setting off another setInterval to call cycler at one second intervals?
> And isn't that going to happen every time you load a new image by
> setting the SRC of the IMG element?. Meaning an ever increasing number
> of setInterval timers calling an ever increasing number of instances of
> the cycle function and all of them trying to set the image to their own
> idea of the current point in the image sequence.
>
> "kind of messed up in mozilla" is probably the least you should expect.
> Try setting:-
>
> cycled_pic.onload = null;
>
> - in the pic_cycler function to ensure that the onload handler is only
> called when the first image is loaded.[/color]
YOU'RE RIGHT!!! That solved it. Instead of doing the
'cycled_pic.onload=null;', I just put the onload in the body tag. Problem
solved. Since I'm still learning
js, so I don't like putting stuff in my
scripts that I don't understand. What exactly does 'cycled_pic.onload=null;'
mean. I know its intended effect, but exactly what is it doing and where is
it supposed to be placed? Thanks.