日期:2014-05-16  浏览次数:20412 次

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>