Quote:
quote:Originally posted by hosefo81
Thanks guys. i finally make it. joefawcett's function does'nt work for me.
|
Tried this code and it works fine, if you'd said you wanted to check for a phone number I'd have made it simpler, originally you said you were checking the customer's forename...
[code]
function isNumeric(Value)
{
var oRE = /^[-+]?(\d*\.)?\d+([eEdD][-+]?\d+)?$/;
return oRE.test(Value);
}
function testValidator(arrTest)
{
var sResult = "";
for (var i = 0; i < arrTest.length; i++)
{
var sTest = arrTest[i];
sResult += sTest + " => " + isNumeric(sTest) + "\n";
}
alert(sResult);
}
testValidator(["0123456", "123a456", "0.123", "-1.1234", "-123456", "-.12345", "123.45E2"]);
[code]
--
Joe