Re: JavaScript using image maps

by Alan Carvalho <alancarv(at)sti.com.br>

 Date:  Mon, 20 Nov 2000 04:40:48 -0200
 To:  hwg-basics(at)mail.hwg.org
 In-Reply-To:  sportsstuff
  todo: View Thread, Original
[Shawn]

>Is it possible to apply a JavaScript action to a specific
>image map?  I'm trying to make certain features and

[Alan]

Yes, according the JavaScript specification published on
http://developer.netscape.com

You can use the following event handlers in AREA tags:

ondblclick
onmouseover
onmouseout

I tested onclick handler in AREA tag (IE 5.5 and NN 4.73) and it works too.
Follow is an example.

&lt;html&gt;
&lt;head&gt;
  &lt;title&gt;Using area and JS&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;img src="dummy.gif" width="200" height="200"
  usemap="#test" border="0"&gt;
  &lt;map name="test"&gt;
    &lt;area shape="rect" coords="0,0,100,100"
    href="#" onclick="alert('Hello!!!');"&gt;
  &lt;/map&gt;
&lt;/body&gt;
&lt;/html&gt;

Note: I used &lt; and &gt; in place of brackets to avoid problems with
e-mail readers that understand HTML, ok?

I hope help you.

Sorry the poor english.

Alan Carvalho
Sao Paulo, Brazil

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA