Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

oncontextmenu on Image Map

Hi,

I am have an image map and I would like to use oncontextmenu for differents
right click menu for each area.

I used the following code but it does not seem to work (using IE 5.5), any
ideas ?


<body>
<img src="panel_EVB2.gif" width="772" height="105" border="0" usemap="#Map">
<map name="Map">
  <area shape="rect" onClick="alert('left');" oncontextmenu="if
(!event.ctrlKey){alert(Right Click');return false;}" coords="280,25,363,69"
href="http://www.cnn.com">
</map>
</body>

Thanks,

Yaron

0
cyaron
Asked:
cyaron
1 Solution
 
gator4lifeCommented:
cyaron -

I think this is a bug in the Internet Explorer browser, because I am running IE 6.0 and it does not work for me either.  When I checked the MSDN Library, Microsoft's documentation states that the onContextMenu event is exposed by the <area> object: http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/area.asp

Just to make sure that this event was firing, I created a <div> to test:

<div oncontextmenu="if (!event.ctrlKey) {window.alert('Right Click'); return false;}">Test onContextMenu Event</div>

This worked just like it should have, so I think that the event not firing on the <area> object is a bug.

gator4life
(chomp, chomp)
0
 
cyaronAuthor Commented:
Thanks for your help,

Yaron
0
 
jaysolomonCommented:
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area:
RECOMMENDATION:

 - [Points to gator4life Grade A]

Please leave any comments here within the next seven days.
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************

jAy
EE Cleanup Volunteer
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now