Solved

Dynamic Usemap with Javascript

Posted on 1998-11-30
2
325 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

757 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

16 Experts available now in Live!

Get 1:1 Help Now