Faqts : Computers : Programming : Shopping For You : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

12 of 15 people (80%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

(How) can I allow a context menu on only a specific object when <body onContextMenu="return false">?

Apr 5th, 2008 20:46
ha mo, Ole Clausen, Colin Snover,


<html>
<script type="text/JavaScript">
function cntxtKill() {
  if (event.srcElement.id!="myPic") return false;
}
</script>
<body oncontextmenu="return cntxtKill();">
<img src="your.gif" id="myPic">
</body>
</html>
This will allow you to get the contextmenu on just that one picture.
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com