菜鸟求助:如何让文本框不能输入任何东西 LZ可以做一个js的控制嘛,给文本的blur事件写一个控制,即验证文本框的值是否符合日期格式,是则正常,否则弹出提示,情况文本框。上述只是一种建议,只是想提醒LZ,换一种思维方式也许能更容易解决问题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 LZ可以做一个js的控制嘛,给文本的blur事件写一个控制,即验证文本框的值是否符合日期格式,是则正常,否则弹出提示,清空文本框。不好意思,打错字了 <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> 设置文本框只读,或者不可用.<input type= "text " name= "test " readonly>OR<input type= "text " name= "test " disabled> 不能输入的话 你绑定onkeydown事件好了 $("#txt").bind("keydown", function (e) { e.preventDefault(); }) 请问什么是javascript 描述语言? javaScript 什么情况下remove方法没有。。。 有一种效果,想让大家帮忙找一下是否有类似效果 谁知道怎么取出text的title js 可否判断 文本框中输入的字符串所花的时间(精确到毫秒) 为什么我取不到值呢? javascript如何插入这样的字符串? jsonp js代码看不懂 一个关于iframe的内容,不知可不要可以实现 script既加载src脚本执行里面的代码如何实现呢 新手求一个随机密码生成的js函数 extjs4 怎么替换掉默认的MessageBox
不好意思,打错字了
<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>
<input type= "text " name= "test " readonly>OR<input type= "text " name= "test " disabled>
e.preventDefault();
})