-- 作者:admin
-- 发布时间:2008/3/17 10:27:01
-- iframe 屏蔽右键
问: 由于在iframe中出于编辑状态,点右键出现插入图象和编辑超级连接等选项,如果应用在论坛中这个插入图象和超连接不好用,现在想禁掉它的右键菜单功能,不知道能不能实现,请指教!! ______________________________________________________________________________________________ 答1: 把这段代码放在你的iframe所在的窗口中的<body>下就行了 <script> //作用:点右键的时候显示隐藏的按钮 if (document.all&&window.print){ document.oncontextmenu=aa; } function aa(){ return false; } </script>
______________________________________________________________________________________________ 答2: 这个代码只能屏蔽掉iframe所在页面的右键功能,但是无法屏蔽在iframe中点击右键弹出的菜单。 还是要谢谢你!! ______________________________________________________________________________________________ 答3: <BODY oncontextmenu="javascript:return false;"> ______________________________________________________________________________________________ 答4: 还是不行,在线等…… 说明一下,是禁用iframe中的右键,不是iframe所在页面的右键。 ______________________________________________________________________________________________ 答5: 禁用iframe中的右键,不是iframe所在页面的右键
这不是一样的吗! ______________________________________________________________________________________________ 答6: 当然不一样了,你试试就知道了,代码如下: <html> <head> <title></title> <link rel="STYLESHEET" type="text/css" href="edit.css"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script> //作用:点右键的时候显示隐藏的按钮 if (document.all&&window.print){ document.oncontextmenu=aa; } function aa(){ return false; } </script> </head>
<body bgcolor="menu" STYLE="margin:0pt;padding:0pt">
<iframe class="Composition" ID="Composition" MARGINHEIGHT="1" MARGINWIDTH="1" width="100%" height="212"> </iframe>
</body> </html> ______________________________________________________________________________________________ 答7: 把iframe包含的那个页面的<body>改成<BODY oncontextmenu="javascript:return false;"> ______________________________________________________________________________________________ 答8: 这样: <html> <head> <title></title> <link rel="STYLESHEET" type="text/css" href="edit.css"> <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head> <script> function loadend(){ Composition.document.write(\'<body oncontextmenu="javascript:return false;">\'); } </script> <body bgcolor="menu" oncontextmenu="javascript:return false;" STYLE="margin:0pt;padding:0pt"> <iframe onload="loadend()" class="Composition" ID="Composition" MARGINHEIGHT="1" MARGINWIDTH="1" width="100%" height="212"> </iframe> </body> </html>
______________________________________________________________________________________________ 答9: oncontextmenu="javascript:return false;" ______________________________________________________________________________________________ 答10: 我也想知道!!! ______________________________________________________________________________________________ 答11: <script> function test1(){ return false; } </script> <body onload="frm.document.body.oncontextmenu=test1"> <iframe name=frm src="1.asp"></iframe> ______________________________________________________________________________________________ 答12: http://expert.csdn.net/Expert/topic/1398/1398960.xml?temp=4.220217E-02
|