Today: 10/10/2008
 

How to find whether argument is numeric or not, using Javascript

Use the code below:

// checks to see whether the input is a numeric string or not also includes "." and "-"
function IsNumeric(strString)
{
	var strValidChars = "0123456789.-"; // valid characters for a numeric string
	var strChar;
	var result = true;
	var i = 0
	if (strString.length == 0) return false;
	// check to see if strString consists of valid characters listed in strValidChars
	while (i < strString.length && result == true)
	{
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) return false;
		i++;
	}
	return result;
}

=======================================================================================

Support Techs Worldwide:

Link to us:

You can support us by putting a link to our website on your blog or website (code is below).

<a href="http://www.techsww.com">
Techs Worldwide - Tutorials about Software Installation,
Configuration, Administration, Monitoring, Tools, Tips &
Tricks
</a>

OR a simple one.

<a href="http://www.techsww.com">
Techs Worldwide - IT related Tutorials
</a>

Feedbacks:

We appreciate feedbacks and suggestions about our tutorials and Techs Worldwide from readers. Please contact us using the form here and let us know what you think about the tutorial and the website in general.

Bookmark Us:

We are working on new features for the website, please keep visiting or bookmark us using your favourite bookmarking service.

Subscribe to RSS:

You can subscribe to our RSS feed here.

 
 
Creative Commons License   Valid XHTML 1.0 Transitional Valid CSS