November 21, 2000 - Removing Attributes
November 21, 2000|
Tips: November 2000
Yehuda Shiran, Ph.D.
removeAttribute()method to the
BODYelement works well in Netscape 6 but doesn't work in Internet Explorer 5.5. This tip is colored yellow by assigning the
<BODY BGCOLOR="yellow">. We remove this background color by the following script:
You can see that the background
color is still yellow in Internet Explorer 5.5 and lower, but is white in Netscape
6. The reason being that the
attribute has been removed by the
This deficiency in Internet
Explorer 5.x does not apply to all element type and attribute combinations.
Internet Explorer can remove attributes from other elements, such as the
tag. The first
element on this tip includes the ad at the top of the page. Its only attribute
If the browser is able to remove this attribute, we should see the ad changing
position from centered to letf-justified. In both Netscape 6 and Internet Explorer
4 and up, you can see that the ad is left-justified. View the source of this
page by clicking the View/Page Source menu entries. Notice that the
attribute is still there. It has been removed when the page loaded, by the following
Notice that you need to specify the attribute names in lowercase.