<script language="javascript">
function disableRightClick(e)
{
var message = 你点击了右键";
if(!document.rightClickDisabled) // initialize
{
if(document.layers)
{
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = disableRightClick;
}
else document.oncontextmenu = disableRightClick;
return document.rightClickDisabled = true;
}
if(document.layers || (document.getElementById && !document.all))
{
if (e.which==2||e.which==3)
{
alert(message);
return false;
}
}
else
{
alert(message);
return false;
}
}
disableRightClick();
</script>
<html>
<head>
<title>禁止点击鼠标右键</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
function click() {
if (event.button==2) { //button==1为左键
alert('右键被禁用啦……')
}
}
document.onmousedown=click
</script></head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- hide
function goHist(a)
{
history.go(a);
}
//-->
</script></center>
</body>
</html>