Monday, May 16, 2011

JavaScript isNumeric Function

This tutorial demonstrate a function that will tell whether given input is integer or not, let just move straight to the code

<script language="javascript" type="text/javascript">

function isNumeric(CHECK_CHAR){
 return !isNaN(CHECK_CHAR);
}

</script>
a sample example will be something like this...
<script language="javascript" type="text/javascript">

alert(isNumeric("1130"));
//true
alert(isNumeric("-17"));
//true
alert(isNumeric("460G"));
//false
</script>

0 comments:

Post a Comment

 

Blog Info

A Pakistani Website by Originative Systems

Total Pageviews

Tutorial Jinni Copyright © 2015 WoodMag is Modified by Originative Systems