在网页中插入
//屏蔽网页右鍵,适用于IE6,IE7,IE8,FireFox,谷歌Chrome浏览器 开始
function clickIE4() {
if (event.button == 2) {
return false;
}
}
function clickNS4(e) {
if (document.layers || document.getElementById && !document.all) {
if (e.which == 2 || e.which == 3) {
return false;
}
}
}
function OnDeny() {
if (event.ctrlKey || event.keyCode == 78 && event.ctrlKey || event.altKey || event.altKey && event.keyCode == 115) {
return false;
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown = clickNS4;
document.onkeydown = OnDeny();
} else if (document.all && !document.getElementById) {
document.onmousedown = clickIE4;
document.onkeydown = OnDeny();
}
document.oncontextmenu = new Function("return false");
//屏蔽网页右鍵,适用于 IE6,IE7,IE8,FireFox,谷歌Chrome浏览器 结束
这段代码可以禁止了鼠标右键,可网页中有一段<p><iframe frameborder="0" scrolling="no" id="Iframe3" src="http://www.cuctv.com/default.aspx?tabid=629&Ptype=beijinglxszy&topicname=%E5%8C%97%E4%BA%AC%E7%95%99%E5%AD%A6%E7%94%9F%E4%B9%8B%E5%A4%9C" style="width: 684px; background: none repeat scroll 0% 0% rgb(255, 255, 255); height: 565px;"></iframe></p>iframe框架,这里面的内容却不能控制,该怎么写呀
你可以尝试在BODY中填充属性来搞定它:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
</head>
<body oncontextmenu="window.event.returnValue=false"
onkeypress="window.event.returnValue=false"
onkeydown="window.event.returnValue=false"
onkeyup="window.event.returnValue=false"
ondragstart="window.event.returnValue=false"
onselectstart="event.returnValue=false">
<!--不能点右键,不用CTRL+A,不能复制作!-->
</body>
</html>