I'm trying to achieve the no right click and the no shift click combined. I have a script that does the job individually, but when put in the same html only one effect occurs.
Can anyone help me put these two together?
Thanks.
<HTML>
<HEAD>
<title>JavaScript</title>
<script language="JavaScript">
<!--
function mouseDown(e) {
var shiftPressed=0;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape"
shiftPressed=(e.modifiers-0>3);
else shiftPressed=event.shiftKey;
if (shiftPressed) {
alert ('Shift-click is disabled.')
return false;
}
}
return true;
}
if (parseInt(navigator.appVersion)>3) {
document.onmousedown = mouseDown;
if (navigator.appName=="Netscape"
document.captureEvents(Event.MOUSEDOWN);
}
//-->
</script>
<script language="JavaScript">
<!--
var message="No Right Click.";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->
</script>
</HEAD>
<body>
<a href="test.html">Test</a>
</BODY>
</HTML>
Can anyone help me put these two together?
Thanks.
<HTML>
<HEAD>
<title>JavaScript</title>
<script language="JavaScript">
<!--
function mouseDown(e) {
var shiftPressed=0;
if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape"
shiftPressed=(e.modifiers-0>3);
else shiftPressed=event.shiftKey;
if (shiftPressed) {
alert ('Shift-click is disabled.')
return false;
}
}
return true;
}
if (parseInt(navigator.appVersion)>3) {
document.onmousedown = mouseDown;
if (navigator.appName=="Netscape"
document.captureEvents(Event.MOUSEDOWN);
}
//-->
</script>
<script language="JavaScript">
<!--
var message="No Right Click.";
function click(e) {
if (document.all) {
if (event.button == 2) {
alert(message);
return false;
}
}
if (document.layers) {
if (e.which == 3) {
alert(message);
return false;
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
// -->
</script>
</HEAD>
<body>
<a href="test.html">Test</a>
</BODY>
</HTML>