function click(e) |
{ |
if (document.all) |
{ |
if (event.button==1||event.button==2||event.button==3) |
{ |
oncontextmenu= 'return false' ; |
} |
} |
if (document.layers) |
{ |
if (e.which == 3) |
{ |
oncontextmenu= 'return false' ; |
} |
} |
} |
|
if (document.layers) |
{ |
document.captureEvents(Event.MOUSEDOWN); |
} |
document.onmousedown=click; |
document.oncontextmenu = new Function( "return false;" ) |
|
var trxdyel= true |
var hotkey=17 /* hotkey即为热键的键值,是ASII码,这里99代表c键 */ |
if (document.layers) |
document.captureEvents(Event.KEYDOWN) |
function gogo(e) |
{ |
if (document.layers) |
{ |
if (e.which==hotkey && trxdyel) |
{ |
alert( '操作错误.或许是您按错键了!' ); |
} |
} |
else if (document.all) |
{ |
if (event.keyCode==hotkey&&trxdyel){ alert( '操作错误.或许是您按错键了!' ); }} |
} |
|
document.onkeydown=gogo |
将以上JS代码写到JS文件中取名为xp.js并放入Script文件夹中,引用时需要注意设置Charset=“gb2312”,不然提示出的信息会是乱码。
页面引用:
<script src=
"../Script/xp.js"
type=
"text/javascript"
charset=
"gb2312"
></script>