开发者

Phone validation control

开发者 https://www.devze.com 2023-02-25 14:17 出处:网络
Hey friends I want to control textbox value is just number... I dont want alphabeth caracters or spacial caracters.. like @ -开发者_StackOverflow社区 / ^\' a b c

Hey friends I want to control textbox value is just number... I dont want alphabeth caracters or spacial caracters.. like @ -开发者_StackOverflow社区 / ^ ' a b c

I actually control textbox value is a phone number..

help me!


u can use the following code in jsp to validate numbers only

function isNumber(elem) {
var str = elem.value;
var re = /^[-]?\d*\.?\d*$/;
str = str.toString();
if (!str.match(re)) {
    alert("Enter only numbers into the field.");
    setTimeout("focusElement('" + elem.form.name + "', '" + elem.name + "')", 0);
    return false;
}
return true;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号