开发者

Phone validation control

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜