http://www.dynamicdrive.com/dynamicindex4/lightbox2/index.htm
http://www.dynamicdrive.com/dynamicindex4/lightbox/index.htm
Showing posts with label Java Script. Show all posts
Showing posts with label Java Script. Show all posts
Monday, November 24, 2008
Thursday, September 18, 2008
How to disable right click (Context Menu) on object in browser
Example in picture object:
Or use this code:
Result:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<script language="javascript">
function disableContextMenu(obj) {
obj.oncontextmenu = function() {
return false;
}
}
function onLoad() {
disableContextMenu(document.getElementById("Pic1"));
}
</script>
</head>
<body onload="onLoad()">
<img id="Pic1" src="Pic1.jpg" alt="Picture" />
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> new document </title>
<script language="javascript">
function disableContextMenu(obj) {
obj.oncontextmenu = function() {
return false;
}
}
function onLoad() {
disableContextMenu(document.getElementById("Pic1"));
}
</script>
</head>
<body onload="onLoad()">
<img id="Pic1" src="Pic1.jpg" alt="Picture" />
</body>
</html>
Or use this code:
<img id="Pic1" src="Pic1.jpg" alt="Picture" onmouseover="this.oncontextmenu=function(){return false}" />
Result:

Labels:
HTML XHTML,
Java Script
Subscribe to:
Posts (Atom)
