posted 22 years ago
Dear friends,
Thanks for your replies,I have written some code where I'm disabling right mouse click and hiding the MenuBar altogether. I know there are ways to get around it but for novice users it will work. My problem now is that this is working for Netscape6.0 but not for IE5.5. For IE5.5 it show error that window.menubar is not an object. Can anybody help on this.
I have changed onClick to oClick in my code as Javaranch does not allow onClick to be posted. Plese make it onClick when u copy and paste the code.
--------------------------------------------------
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<script language="JavaScript">
window.menubar.visible=false;
function disableMenu(){
window.menubar.visible=false;
}
function enableMenu(){
window.menubar.visible=true;
}
</script>
</head>
<body bgcolor="#FFFFFF">
<script language="JavaScript">
document.oncontextmenu = function(){return false}
if(document.layers) {
window.captureEvents(Event.MOUSEDOWN);
window.onmousedown = function(e){
if(e.target==document)return false;
}
}
else {
document.onmousedown = function(){return false}
}
</script>
<form name=frm>
<input type=button name=btn value="Hide menubar" oclick='disableMenu()'/>
<input type=button name=btn value="Show menubar" oclick='enableMenu()'/>
</form>
</body>
</html>
--------------------------------------------------
Thanks
Ashish