Image Maps, attributes and javascript

J

Jeff Cooper

Hi folks,

I'm trying to get an onmouseover javascript event to fire on an image map in
an aspnet page.

I've added the map and area tags to the HTML and pointed to it with using
the image's useMap attribute. But, I'd like the map to run a little
javascript (swapping the image's src for another) during an onmouseover
event in the map area. I tried setting runat=server for both the Map tag
and the Area tag, but they don't seem to get seen by the codebehind, so I
can't issue an attributes.add ("onmouseover",myJavasciptString) to it.
Anyone have any thoughts?

I know the javascript itself is fine, because I can trigger it by moving the
mouse over any part of the image when I put add the onmouseover attibute to
the image control.

If I add the onmouseover attribute directly in the Area html tag, it has no
effect.

In short, how do I add attributes to map areas, since adding them directly
in the html seems to have no effect? If it's not possible, how do I run a
javascript during a mouseover event on a part of an image -- I do not want
to do a postback, thus the javascript.

Thanks for any ideas,

Jeff
 
N

Natty Gur

Hi,

Is that what you after ?

<map name="linkmap">
<area href="" onmouseover="alert('on');" shape="RECT"
coords="0,0,135,150">
</map>
<asp:Image id="Image1" src='image003.gif' border="0" usemap="#linkmap"
runat="server"></asp:Image>

Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 

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

Top