[thelist] Javascript: altering BG color of multiple divs with one click - solved

Hershel Robinson hershelr at netvision.net.il
Tue Nov 11 14:25:38 CST 2003


> Sorry, typos galore!
> I meant:
>
> if (i = 0)
>
> crashed my browsers, while this:
>
> if (i != 0)
>
> doesn't. So I had to swap the logic around a little bit.
>
> _That_ I find odd :o)

LOL at the typo. :)

The line

if (i = 0)

is not syntactically valid JS. The = character is assignment not comparison.
To compare i to zero you would use:

if (i == 0)

Hershel



More information about the thelist mailing list