把下列代码放到<body></body>或者<head></head>之间
<script LANGUAGE="JavaScript">
function click() { if (event.button==2)
</script>
alert('……')是右键单击引发的事件,你也可以改成其它事件,如打开收藏夹,只要把alert那一句代码改成al.addFavorite('ang','毓秀学院')即可
这种禁止右键是不可靠的:依次按下左键,右键,然后再松开左键,松开右键,好了!标准的右键菜单又出来了.
一、禁止点击鼠标右键1:
<SCRIPT language=JavaScript>
<!--
鼠标右键不能用file://锁鼠标右键和键盘CONTEXTMENU键
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) { alert("欢迎光临寒舍,有什么需要帮忙的话,请与站长联系!谢谢您的合作!!!");
oncontextmenu='return false';
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
// -->
</SCRIPT>
二、禁止点击鼠标右键2:
<!--将以下代码加入HTML的<HEAD></HEAD>之间-->
<script language="javascript">
function click() {
if (event.button==2) {
alert('欢迎光临寒舍,有什么需要帮忙的话,请与站长联系!谢谢您的合作!!!')
}
}
</script>
三、禁止鼠标右键3(推荐):
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) load();
}
MM_reloadPage(true);
//-->
</script>
</head>
<body leftmargin=0 topmargin=0 onmousemove='HideMenu()' oncontextmenu="return false" ondragstart="return false" onselectstart ="return false" onselect="pty()" oncopy="pty()" onbeforecopy="return false" onmouseup="document.selection.e
mpty()">
<noscript><iframe src=../../*></iframe></noscript>
发布评论