屏蔽右键代码:
<html>
<head>
<script>
function click(e) {
if (document.all) { //ie
if (event.button==1||event.button==2||event.button==3) {
oncontextmenu='return false';
}
}
if (document.layers) { //ff
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {//other
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;")
</script>
</head>
<body>
//测试文本
</body>
</html>
网上搜索的
document.oncontextmenu = new Function("return false;")
</script>
晕 就一句话就够了
开始写的时候写的是document.body
貌似这中document.body的写法ff中不支持 所以没有屏蔽掉