Coding Tips Daily Blog

Programming tips, tricks and advice from Jonathan Leger, a seasoned professional programmer/analyst.
 
ASP.NET, VB.NET, Visual Basic, MS Access, MS SQL Server, PHP, MySQL, JavaScript and more!

Email Me

Monday, July 19, 2004

JavaScript Function Is Numeric (validate number, valid number)

This function checks the passed text to see if it is a numeric value and returns True if it is, False if it is not.


/*
IsNumeric - true for all numeric, false if not
*/
function IsNumeric(PossibleNumber)
{
var PNum = new String(PossibleNumber);
var regex = /[^0-9]/;
return !regex.test(PNum);
}
Posted by Unknown at 7:12 AM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Post Older Post Home

Blog Archive

  • ▼  2004 (38)
    • ▼  07/18 - 07/25 (13)
      • JavaScript Functions for Working with Cookies
      • JavaScript Form Validation Functions (validate input)
      • JavaScript Function to Validate U.S. State (valid ...
      • JavaScript Function Allow Number keys Only (only d...
      • JavaScript Function Validate Date (valid date)
      • JavaScript Function to Validate SSN (valid ssn)
      • JavaScript Function to Validate Phone Number (vali...
      • JavaScript Function Is Numeric (validate number, v...
      • JavaScript Function to Validate Email Addresses (v...
      • JavaScript Function to Validate Zip codes (valid z...
      • JavaScript Function to Trim White Space (RTRIM)
      • JavaScript Function To Trim White Space (LTRIM)
      • JavaScript Function to Format Currency (Money)
    • ►  07/04 - 07/11 (1)
    • ►  06/20 - 06/27 (1)
    • ►  05/16 - 05/23 (3)
    • ►  05/09 - 05/16 (7)
    • ►  01/25 - 02/01 (2)
    • ►  01/18 - 01/25 (4)
    • ►  01/11 - 01/18 (6)
    • ►  01/04 - 01/11 (1)

About Me

Unknown
View my complete profile
Awesome Inc. theme. Powered by Blogger.