Monday, June 08, 2009

isNumeric for web

as I think the best approach to check value in web for IsNumeric is:
function IsNumeric(inputVal,sErrorMsg) {
if (isNaN(parseFloat(inputVal))) {
alert(sErrorMsg)
return false;
}
return true
}

I also used such approach, but I don't like it anymore
function IsNumeric(expression) {
var nums = "0123456789";
if (expression.length==0)return(false);
for (var n=0; n <>
if(nums.indexOf(expression.charAt(n))==-1)return(false);
}

return(true);
}

2 comments :

Jens Polster said...
This comment has been removed by the author.
Jens Polster said...

Also see this post for Lotus Domino based web sites.