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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE: Element.setAttribute not working 1

Status
Not open for further replies.

iturner

Programmer
Joined
Apr 26, 2006
Messages
1
Location
US
I'm working on a application that needs to use the DOM to dynamically edit attributes for elements. But for some reason Internet Explorer doesn't recognize the command setAttribute(attribute, value)

Code:
document.getElementById("mapimage").innerHTML = data[map][5];
var usemap = "#" + data[map][0];
document.getElementById("trans").setAttribute("usemap", usemap);

On the first line I'm populating the imagemap with the data I got from the server. Line 2 makes the imagemap reference and line 3 should set the new imagemap. But on testing the attribute stays the same.

Anyway to get around this in IE? It works great in Firefox.
 
Welcome to the world of IE and it's non-standard calls ;-)

You should add a third parameter, which will do nothing in compliant browsers, but it will tell IE to ignore any case issues:

Code:
setAttribute('usemap', usemap, 0);

Read here for more:


Hope this helps,
Dan

Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top