把这段代码放在你的iframe所在的窗口中的<body>下就行了
<script>
//作用:点右键的时候显示隐藏的按钮
if (document.all&&window.print){
document.oncontextmenu=aa;
}
function aa(){
return false;
}
</script>
<script>
//作用:点右键的时候显示隐藏的按钮
if (document.all&&window.print){
document.oncontextmenu=aa;
}
function aa(){
return false;
}
</script>
还是要谢谢你!!
说明一下,是禁用iframe中的右键,不是iframe所在页面的右键。
<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>
<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>
function test1(){
return false;
}
</script>
<body onload="frm.document.body.oncontextmenu=test1">
<iframe name=frm src="1.asp"></iframe>