[thelist] Javascript: altering BG color of multiple divs with one click - solved
Dunstan Orchard
dunstan at 1976design.com
Tue Nov 11 13:37:43 CST 2003
Hi there,
> Hershel Robinson wrote some JS code for me...
Thanks for that Hershel, that got me started down the right road and I now have
a fully working version of what I want:
http://www.1976design.com/dev/divcolor/
I discovered the problem with my code was that this:
(i != 0)
crashed my browsers, while this:
if (i != 0)
doesn't.
Eg. This works:
for (var i = 0; i < relatedItems.length; i++)
{
if (i != 0)
{
document.getElementById(relatedItems[i]).className = "question";
}
else
{
document.getElementById(relatedItems[i]).className = "answer";
}
)
Very odd :o/
Thanks - Dunstan
---------------------------
Dorset, England
http://www.1976design.com/
http://www.1976design.com/blog/
More information about the thelist
mailing list