日期:2014-05-16 浏览次数:20383 次
<input type="text" value="TEST" id="demo" /> <script type="text/javascript"> document.getElementById('demo').onkeydown = function() { return false; } </script>
------解决方案--------------------
试试这样:
window.onload=function(){ var testInput = document.getElementById('test'); testInput.onkeyup = function() { this.value=this.value.replace(/[\s\S]/g,''); //stopDefault(e); } } </script> <form name="formA" method="post" > <input type=text name="a" id="test" > <form>
------解决方案--------------------
设置文本框只读,或者不可用.
<input type= "text " name= "test " readonly>
OR
<input type= "text " name= "test " disabled>
------解决方案--------------------
不能输入的话 你绑定onkeydown事件好了