Dynamic Usemap with Javascript

I have a very large Image and have direction-buttons to navigate over them (with arrays). To change the Image is no problem, but how can I change the map? I have just make the HTML-Side with document.write, but now, I become an error when I`m clicking on one direction-button (JavaScript Error: incorrect number of arguments). Have any an idee? Thanks!
Who is Participating?
Michel PlungjanConnect With a Mentor IT ExpertCommented:
1. To change the actual areas you will need to use transparent layers and DHTML, with somewhat limited browser support.
An IMHO  better way is to have an array of hrefs.

I will continue in a comment.
Michel PlungjanIT ExpertCommented:
If you map all the possible hrefs, you can swap hrefs onmouseover or onclick somewhere else:
/* The array below can be made 1.0 compatible if needed */
theMaps = new Array()
theMaps[0] = new Array('page1.html',null,null);
theMaps[1] = new Array(null,'page2.html',null);
theMaps[2] = new Array(null,null,'page3.html');

CurrentMap = 0;

function goThere(idx) {
   theHref = theMaps[CurrentMap][idx];
   if (theHref != null) location = theHref;
fucntion myVoid() { ; } // nothing
<A HREF="javascript:myVoid()" onClick:CurrentMap=0;"><IMG...></A>
<A HREF="javascript:myVoid()" onClick:CurrentMap=1;"><IMG...></A>
<A HREF="javascript:myVoid()" onClick:CurrentMap=2;"><IMG...></A>
<AREA.... HREF="javascript:goThere(0);>
<AREA.... HREF="javascript:goThere(1);>
<AREA.... HREF="javascript:goThere(2);>

So the click in the href will change the links in the map.

Hope I made myself clear,

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.