关于使用php作为主要编码进行验证时的字母限制n javascript作为附加混合编码 [英] Regarding alphabet restriction in validating using php as main coding n javascript as additional mix coding
本文介绍了关于使用php作为主要编码进行验证时的字母限制n javascript作为附加混合编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何限制字母键入n允许使用javascript键入数字
how to restrict alphabet from keying in n allowing numbers to be key in using javascript
推荐答案
是的,我尝试了一些编码,但没有成功
这是代码:
yes bro i tried some codings but it didnt work
this are the codes:
<script type = "text/javascript">
function IsNumeric(strString)
// check for valid numeric strings
{
var strValidChars = "0123456789.-";
var strChar;
var blnResult = true;
if (strString.length == 0) return false;
// test strString consists of valid characters listed above
for (i = 0; i < strString.length && blnResult == true; i++)
{
strChar = strString.charAt(i);
if (strValidChars.indexOf(strChar) == -1)
{
blnResult = false;
}
}
return blnResult;
}
function validate()
{
if(document.frm.student_ID.value==""){
alert("Please enter ads fee");
document.frm.student_ID.focus();
return false;
}
if (IsNumeric(document.frm.student_ID.value) == false)
{
alert("Enter Integer value!");
return false;
}
}
</script>
这篇关于关于使用php作为主要编码进行验证时的字母限制n javascript作为附加混合编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文