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

Plunkett, Matt MPlunkett at MSA.com
Tue Nov 11 15:14:13 CST 2003



-----Original Message-----
From: Hershel Robinson

> 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)

if (i = 0) 

is perfectly valid syntactically.  It just doesn't do what he intended,
which is what makes bugs of this type so annoying to ferret out.  It will
always be true.

I agree with the original poster that it is odd that this crashed his
browser.


More information about the thelist mailing list