<input type="button" value="test" onclick="document.body.oncopy=function(){return true;}">这样...但是我看你还是也得先把onselectstart 这个事件也一起取消掉吧,不然人家如何复制,哈哈......

解决方案 »

  1.   

    可以设置一个hidden变量iscopy,通过判断iscopy的值来设置oncopy的值,可以实现。
      

  2.   

    谢谢楼上两位,可以实现现在又有新问题
    我用<iframe>将要copy的网页内容包含到我的页面中来。
    点test没有作用。
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <table align=center width="100%" height=600>
    <tr>
    <td valign=top align=left>
    <form name="form1" method="post" action="guodong.asp">
      <input name="address" type="text" id="address" size="60">
      <br>
      <input type="submit" name="Submit" value="提交">
    </form>
    <br>
    </td>
    </tr>
    <%
    Address=Request("address")
    Response.write address
    %>
    <tr>
    <td height=600>
    <iframe src="<%=address%>" width="100%" height=600 name=001></iframe>
    </td>
    </tr>
    <tr>
    <td>
    <input type="button" value="test" onclick="document.001.body.oncopy=function(){return true;};document.001.body.onselectstart=function(){return true;};document.001.body.oncontextmenu=function(){return true;};">
    </td>
    </tr>
    </table>防copy页面示例:www.teaonweb.com/hnsy/web/1.htm
      

  3.   

    <body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" oncontextmenu="return false;" oncopy="return false;" onselectstart="return false;">
         '内容
         ......
         ......
         ......
     <input type="button" value="test" onclick="f();">
    </body>
    <script>
      function f(){
        document.body.oncontextmenu=null;
        document.body.oncopy=null;
        document.body.onselectstart=null;  }
    </script>
      

  4.   

    在iframe上加上属性 id="001"代码中交换"001"和"document"的位置,按钮代码改为<input type="button" value="test" onclick="
    001.document.body.oncopy=function(){return true;};
    001.document.body.onselectstart=function(){return true;};
    001.document.body.oncontextmenu=function(){return true;};">