PBDR.COM

About   -   Contact   -   Purchase   -   Search   -   What's New

 
 
Javascript Validate Phone Number
This function can be called from your client side form validation function to test if a phone number field contains only characters valid for a phone number.
function istelnum(s)
{ 
  var valChar='0123456789 -()+'

  for (var i=0; i < s.length; i++) {
    var c=s.charAt(i);
	if( valChar.indexOf(c) == -1 ) return false;
  }
  return true;
}
Tested on Browser OK
IE 5 Y
IE 4 Y
 

Top of Page

Legal Notice

Ken Howe 2011