Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Firefox and backgroundColor

Status
Not open for further replies.

RicksAtWork

Programmer
Nov 1, 2005
120
GB
I have the following code:

alert(controls.style.backgroundColor);
if(controls.style.backgroundColor == "rgb(255,0,0)")
{
alert('hurrah!');
}

The first alert displays a prompt reading: rgb(255,0,0)

The second alert doesnt occur!!!

What am I doing wrong??
 
Try putting spaces after your commas:

Code:
== "rgb(255, 0, 0)"

Note that this won't work in all browsers, as some give a different format to the RGB format.

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanks for the pointers.

How would you approach this then?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top