首页 > 网站 > WEB开发 > 正文

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

2024-04-27 14:02:13
字体:
来源:转载
供稿:网友

<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版本支持了一个函数


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表