javascript 限制输入和粘贴 IE和火狐3.x下测试通过


<html>
<head>
<script type="text/javascript">
 function upLoadKey(e){
  ((document.all) ? true:false) == true ? (window.event.returnValue = false): e.preventDefault();
 }
</script>
</head>
<body>
     <input name="textfield3" type="file" class="input" id="textfield3" size="30" value="" onkeydown="upLoadKey(event);" onpaste="return false;" onmousedown="document.oncontextmenu = function() { return false;}" onmouseout="document.oncontextmenu = function() { return true;}" style = "ime-mode:disabled" />
</body>
</html>

  但是这段代码在 火狐2.x的下面,还是无法对onpaste()这个函数的支持,好消息是火狐的3.x版本支持了一个函数


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3