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

image swaps and imagemaps 1

Status
Not open for further replies.

MasterKaos

Programmer
Jan 17, 2004
107
GB
I am trying to swap the underlying imagemap that belongs to an image i am swapping. What i need to do is set the usemap attribute.

I have had some success by using
Code:
document.pic.setAttribute("usemap", "#map");
where pic is the id of the image element.

This works correctly in FireFox, but not in MSIE. I have tried sending an alert to display the usemap value after the change and as expected in FireFox it returns the new imagemap but in MSIE it returns the old one.

You can find the page here:
but don't freak if it's not there or if it's changed because it's a work in progress. I'll post here if i find the solution and the above link is no lomger relevant.

Any ideas?

----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
 
Try adding a third parameter, ", 0" to your setAttribute method call:

Code:
document.pic.setAttribute("usemap", "#map", 0);

It tells IE to ignore any case-sensitivity issues. While non-standard, it should not break other browsers.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Thanx BillyRay, that did the trick!!!

Note to anyone that visits the above URL: the feature i sought help about now works, whereas other things may not since it's under development.

----------------------------------------------------------------------------
The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top