Solved

Dynamic Usemap with Javascript

Posted on 1998-11-30
2
327 Views
Last Modified: 2008-03-10
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!
0
Comment
Question by:frusti
  • 2
2 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 150 total points
ID: 1274774
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.
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1274775
If you map all the possible hrefs, you can swap hrefs onmouseover or onclick somewhere else:
<SCRIPT>
/* 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
</SCRIPT>
<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>
<MAP>
<AREA.... HREF="javascript:goThere(0);>
<AREA.... HREF="javascript:goThere(1);>
<AREA.... HREF="javascript:goThere(2);>
</MAP>

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

Hope I made myself clear,

Michel
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now