当前位置: 代码迷 >> JavaScript >> javascript 限制输入跟粘贴,兼容IE和火狐3.x
  详细解决方案

javascript 限制输入跟粘贴,兼容IE和火狐3.x

热度:32   发布时间:2012-11-07 09:56:10.0
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" />

<div>

window.event.returnValue = false? 屏蔽ie键盘输入

<br>

e.preventDefault()? 屏蔽firefox键盘输入

<br>

http://www.my400800.cn

</div>
</body>
</html>

  相关解决方案