Closed Bug 298424 Opened 20 years ago Closed 20 years ago

javascript returns the wrong value when looking at the background stylesheet property of an object

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: jasonkirk, Unassigned)

Details

User-Agent:       Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4

when you use javascript to change the background style 
(object.style.background) of an object (object.style.background='blue') and 
then check the value of object.style.background, firefox returns extra data 
along with the value.

Reproducible: Always

Steps to Reproduce:
<script language = javascript>
function Select(obj)
{
alert(obj.style.background.toString());  //Correctly returns an empty string
obj.style.background = "blue";
alert(obj.style.background.toString());  //Returns   blue none repeat scroll 
0% 0%     instead of just blue
}
</script>
<input type='text' onclick='Select(this);'>
Actual Results:  
FireFox 1.0.4 returns

blue none repeat scroll 0% 0%

Expected Results:  
IE returns

blue

From what I can tell, there's no easy way to find the background color of an 
object in FireFox since it returns the extra text.  I have found ways around 
it but it will probably mean more work for me later if I ever change my site.  
FireFox should return just the background color like IE does.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.