Closed Bug 630168 Opened 15 years ago Closed 15 years ago

document.getElementById(id).style.backgroundColor reformats the supplied color

Categories

(Firefox :: General, defect)

x86
Windows 7
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 110762

People

(Reporter: mullerhe, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.1; fr; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Bug of the day</title> <style> #smartbox { width: 150px; font: bold 16pt verdana; text-align: center; padding: 30px 0px; color: white; } </style> <script type="text/javascript"> function showbox() { var id = 'smartbox'; var white = 'rgb(255,255,255)'; document.getElementById(id).style.backgroundColor = white; if (document.getElementById(id).style.backgroundColor == white) document.getElementById(id).style.backgroundColor = 'red'; else document.getElementById(id).style.backgroundColor = 'blue'; } </script> </head> <body onload="showbox();"> Another way to tell IE from Firefox.<br> <br> This box becomes <b>RED</b> with IE, and <b>BLUE</b> with Firefox :<br> <br> <div id="smartbox">SMART BOX</div> </body> </html> Reproducible: Always Steps to Reproduce: 1. Please copy the code above into a html page and display it. Self explanatory (I hope...) 2. 3. Actual Results: IE and Firefox behavior discrepancy. I think the bug is with Firefox. Expected Results: IE and Firefox should work the same way; at least Firefox should give back what it was fed.
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.