禁止IE下右键等功能

window.setInterval(function(){
	       document.oncontextmenu=function(e){return false;}
		   document.onselectstart = document.oncontextmenu= document.onmousedown= function(){return false;};
		   document.onkeydown = keyDown;
     },150)
	 
	 function keyDown(e) { 
           var currKey=0,e=e||event;
            currKey=e.keyCode||e.which||e.charCode;
          var keyName = String.fromCharCode(currKey);
			   if(currKey == 67 || currKey == 86 || currKey == 17 || currKey == 65) {
			     try{
				     window.clipboardData.setData("Text","");
				 }catch(e){
				     //window.open("为保护产权,不支持该操作!");
				    // alert("为保护产权,不支持该操作!");
				     location.replace(location.href);
				 }finally{
				     return false;
				 }
			  }
         }

你可能感兴趣的:(JavaScript,IE)