onclilck variable

R

Richard

http://1-large-world.com/stargate/map2.html

When you mouse over one of the chevrons, the main image changes.
What I'd like do next is to have an onclick instead of onmouseout.
So that a variable would tell the function which new area to go to.

For instance:
chevronclick=0 on load.
clicking at chevron 4 would set the variable to 4.
The proper url selected by the variable.

thanks.
 
T

The Plankmeister

For instance:
chevronclick=0 on load.
clicking at chevron 4 would set the variable to 4.
The proper url selected by the variable.

I'm pretty sure that just declaring a global variable as the first line
inside your script, then setting it with an onclick would work... thus:

[snip]
var chevronclick = 0;
if(document.images) {
pics = new Array(12);
pics[1] = new Image();
pics[1].src = "main.gif";
[snip]

[snip]
<AREA SHAPE="CIRCLE" COORDS="110,60,-41" HREF="#"
onClick="chevronclick=4" onMouseOver="changer('img1',4)">
[snip]


I've not tested this but that should work.

Alternatively, why not just put the appropriate URL in the HREF? From what I
can see that would be an easier approach. But I'm not privy to all the facts
:)

HTH.

P.
 

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

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,157
Latest member
MercedesE4
Top