通过js控制html页面不能右键,复制等

 <script type="text/javascript">

  //Method one

  //<![CDATA[ 

  //document.oncontextmenu=new Function('event.returnValue=false;');

  document.oncontextmenu = function (e) { e = e || window.event; e.returnValue = false; }

  document.onselectstart = new Function('event.returnValue=false;');

  //]]> 

 </script>

<!--Method two-->

<body oncontextmenu="return false" onselectstart="return false"></body>

 

你可能感兴趣的:(html)