[Javascript] Is Numeric Function

jsWalter jsWalter at torres.ws
Fri Feb 20 12:13:08 CST 2004


Well, thjis is how I validate a ohone...

is_usphone = function ( strValue )
{
	// define Regular Expression for Phone Number
	// Pattern matches:
	//    (999) 999-9999  (999) 999.9999  (999) 999 9999  (999) 9999999
	//    (999)-999-9999  (999)-999.9999  (999)-999 9999  (999)-9999999
	//    (999)9999999     999-9999999     999 9999999     9999999999
	//     999/999-9999,   999/999.9999    999/999 9999    999/9999999
	//     999-999-9999    999.999.9999    999 999 9999    9999999999
	var reValidChar = /^((\((\d{3})\)|(\d{3}))[\/ -.]?)?(\d{3})[-. ]?(\d{4})$/;


	// See if the passed in String has any invalid Characters
	// this returns a Boolean
	return ( reValidChar.test ( strValue ) );
}


I have an (almost) complete validation class at...

    http://groups.yahoo.com/group/javascript_validation/

drop over, see if it helps.

Walter





More information about the Javascript mailing list