验证输入字符不应该是使用javascript的文本

验证输入字符不应该是使用javascript的文本

问题描述:

我有一个文本框,我希望该用户不能输入字符
仅使用Java脚本允许的数字值.我尝试将代码作为

函数checkforinteger(e)
{var a = document.getElementById("textbox1");
if(window.event)
{a = e.keycode
}

}

我也希望该用户在正确之前不能进入下一个文本框
错误.我认为可以使用onblur.但是我不知道如何使用javascript代码编写它.我对javascript .plz帮助非常陌生.还给了我一些提示,如果我按照

hi i have a textbox i want that user should not be able to enter character
only numeric value allowed using java script .i try the code as

function checkforinteger(e)
{var a=document.getElementById("textbox1");
if(window.event)
{a=e.keycode
}

}

also i want that user will not b able go to next textbox till he correct
the error.i think it is possible using onblur.but i dont know how to write it using javascript code .i m very very new to javascript .plz help. also give me some tips how can i improved my javascript with site should i follow

尝试创建一些Google的方法,该如何改善网站的JavaScript.比在这里等待答案更好.
将字段限制为仅数字 [ JavaScript教程 [ ^ ]
try to do some google. its better than waiting answer here.
Restricting a Field to Numbers Only[^]
This is the One of the best JavaScript tutorials in the Web.
JavaScript Tutorial[^]