[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: calling a function in an imagemap



At 10:12 2/15/96 -0600, you wrote:
>Hello evry1,
>
>I was wondering if there was a way to call a javascript function in the 
>page instead of a url when clicking on a certain point on an imagemap???
>
>

Try using a client-side imagemap, here is a small example:

In the script area:
function choose(buttonNum) {
   // hrefArray is an array of urls defined somewhere else.
   location = hrefArray[buttonNum];
}

In the body:
<!-- create the imagemap -->
<MAP NAME="buttonbar">
<AREA SHAPE="RECT" COORDS="10,10,49,49" HREF="javascript:choose(1)">
<AREA SHAPE="RECT" COORDS="60,10,99,49" HREF="javascript:choose(2)">
<AREA SHAPE="RECT" COORDS="110,10,149,49" HREF="javascript: choose(3)">
<AREA SHAPE="RECT" COORDS="0,0,159,59" HREF="javascript:choose(4)>
</MAP>
<!-- hook image to  -->
<IMG SRC="../images/tech/bar.gif" USEMAP="#buttonbar">


Please excuse any syntax errors (of worse) I haven't tested it.

-eric
-----------------------
Eric Anderson
Software Developer
AXIS Web Publishing
Voice: 206.729.0550
-----------------------