You can use the range validator from ASP.NET. If you wanted to go the
route of JavaScript, you will have to use a regular expression.
Certain functions like parseInt() will still pick up trailing alpha
characters such as "123a" will result in 123. I would suggest using
the following to return True or False;
function checkNum(val) {
return (/^[0-9]+$/.test(val));
}
This will allow 1 or more numbers, but will not allow decimals. It can
be modified to do such a thing.
Thanks,
Ian Suttle http://www.IanSuttle.com
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.