不能手动输入或粘贴

时间:2022-11-02 16:41:04
function getOs(){
 	var OsObject = "";
 	if (navigator.userAgent.indexOf("MSIE") > 0) {
 		return "MSIE";
 	}
 	if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
 		return "Firefox";
 	}
 	if (isSafari = navigator.userAgent.indexOf("Safari") > 0) {
 		return "Safari";
 	}
 	if (isCamino = navigator.userAgent.indexOf("Camino") > 0) {
 		return "Camino";
 	}
 	if (isMozilla = navigator.userAgent.indexOf("Gecko/") > 0) {
 		return "Gecko";
 	}
 }

 function forbid(){
		if(getOs() == 'MSIE'){
			if(event.keyCode!=46){if(event.preventDefault)event.preventDefault();else event.returnValue=false;}
		}
	}
:onkeydown => "forbid();", :oncontextmenu => 'forbid();'