img usemap via JS

L

LEMAIRE Mathieu

I wanna change the usemap of an image with JS.. how to do it ?
Here's what I've tried (doesn't work) :

<img src='contenu.jpg' alt='' name='contenu' usemap='#map1'/>

<map name="map1"><area shape="rect" coords="0,0,20,20" href="#" /></map>
<map name="map2"><area shape="rect" coords="200,20,40,40" href="#" />
</map>

<a href='#' onclick="document['contenu'].usemap='map2';" >map2</a>
<a href='#' onclick="document['contenu'].usemap='map1';" >map1</a>

thank you
 
D

Dietmar Meier

LEMAIRE said:
<map [...] href="#" /></map>

<a href='#' onclick="document['contenu'].usemap='map2';" >map2</a>
<a href='#' onclick="document['contenu'].usemap='map1';" >map1</a>

<a href='#' onclick="document.images['contenu'].useMap='#map2'">map2</a>
<a href='#' onclick="document.images['contenu'].useMap='#map1'">map1</a>

ciao, dhgm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,108
Latest member
AlbertEste
Top