首页 新闻 赞助 找找看

js屏蔽网页鼠标右键问题!

0
悬赏园豆:10 [已关闭问题] 关闭于 2011-12-28 15:08

在网页中插入

//屏蔽网页右鍵,适用于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&amp;Ptype=beijinglxszy&amp;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框架,这里面的内容却不能控制,该怎么写呀

luckydd的主页 luckydd | 初学一级 | 园豆:77
提问于:2011-12-07 10:50
< >
分享
所有回答(1)
0

你可以尝试在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>

VampireEarl | 园豆:21 (初学一级) | 2011-12-07 11:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册