Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How show rectangles in a asp.net ImageMap?

2 views
Skip to first unread message

b. hotting

unread,
Oct 27, 2009, 11:44:59 AM10/27/09
to
Hi All,

How can I show drawn rectangles (the hotspots) in a asp.net ImageMap? (so
the user knows where to click)
i understand that its not possible to use java script in combination with
the imageMap server control, correct?
even better would be the MouseOver event to highlight the active rectangle
where the mouse is on, but that's a bonus ;-)

Is there another way to show rectangles? (and change (delete/add new ones)
them as i change the image on the server side?

if you can point me in the right direction, that would be great.
A demo/tutorial website/etc...

Thanks,
B.


Alexey Smirnov

unread,
Oct 27, 2009, 1:22:07 PM10/27/09
to

Do you really need to have a server control there? HTML Image Maps
support onMouseOver event.

here's an example on how you can integrate js with HTML image maps
http://www.w3schools.com/JS/js_image_maps.asp

b. hotting

unread,
Oct 28, 2009, 9:23:27 AM10/28/09
to
Hi Alexy,

thanks, but I do need the server control.

to simplify the question:
How can i show/hide a shape (rectangle in my case) (in an image) with a
mouse over (or enter/leave) event?

what is the 'normal' way to draw (rectangles)?
i'm sure there must be an example out there where on the fly drawing occurs.

"Alexey Smirnov" <alexey....@gmail.com> wrote in message
news:3a4dacf3-e507-4c4d...@y10g2000prg.googlegroups.com...

Andrew Morton

unread,
Oct 28, 2009, 10:08:36 AM10/28/09
to
b. hotting wrote:
> to simplify the question:
> How can i show/hide a shape (rectangle in my case) (in an image) with
> a mouse over (or enter/leave) event?
>
> what is the 'normal' way to draw (rectangles)?

The normal way would be to cut the image up into rectangles, assemble them
in a <table>, and swap them with Javascript or CSS. Or use Flash or perhaps
Silverlight so that you can draw borders/rectangles over the image
client-side.

Maybe an imagemap is not what you need for the interactivity you want.

Andrew


Alexey Smirnov

unread,
Oct 28, 2009, 6:05:09 PM10/28/09
to
On Oct 28, 2:23 pm, "b. hotting" <bhott...@REMOVtHISwxs.nl> wrote:
> Hi Alexy,
>
> thanks, but I do need the server control.
>
> to simplify the question:
> How can i show/hide a shape (rectangle in my case) (in an image) with a
> mouse over (or enter/leave) event?
>
> what is the 'normal' way to draw (rectangles)?
> i'm sure there must be an example out there where on the fly drawing occurs.
>

Asp.net ImageMap does not support the mouseover effect, and you can
either override RectangleHotSpot class to add this possibility, or you
use a simple javascript trick like here

<script type="text/javascript">
var areas = document.getElementsByTagName("area");
for (var i = 0; i < areas.length; i++) {
var area = areas[i];
area.setAttribute("onMouseOver", "alert('Hello World')");
}
</script>

This script must be added after your ImageMap Control. You should see
alert('Hello World') when mouse is over defined hot spot region.

Now to get a rectangle or an image over the map you should do more
complex script, like on the following link

http://codingforums.com/showthread.php?t=95595

0 new messages