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

Joshua Olson joshua at waetech.com
Tue Nov 11 16:32:51 CST 2003


----- Original Message ----- 
From: "Plunkett, Matt" <MPlunkett at MSA.com>
Sent: Tuesday, November 11, 2003 4:14 PM


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

Matt, et al,

In this case that statement actually ASSIGNS the variable i the value of 0,
which will cause the for loop to continue indefinitely since i will never
reach the value of relatedItems.length.  It will, therefore, appear to crash
the browser.

<><><><><><><><><><>
Joshua Olson
Web Application Engineer
WAE Tech Inc.
http://www.waetech.com
706.210.0168



More information about the thelist mailing list