Click to See Complete Forum and Search --> : style.color does not work in firefox


baburman
January 29th, 2008, 04:33 AM
Hi all,

The following code runs fine on internet explorer but not in firefox.
I figured out that elm[i].style.color is not working, there's no error
displayed either. Will anybody help me find the correct code for firefox?

Thanks a lot.

var elm = document.getElementsByTagName("a");
//alert(elm.length);

for(var i=0;i<elm.length;i++)
{
if(elm[i].style.color=="saddlebrown")
alert(elm[i].style.color);

}

PeejAvery
January 29th, 2008, 06:49 AM
The reason is because saddlebrown is only going to be recognized by IE. You need to use hexidecimal colors instead of color names.

baburman
January 29th, 2008, 11:01 PM
Thankyou very much, i'll do this when i go to office.

Babur