Posted By

sekihin on 04/27/09


Tagged

javascript number check


Versions (?)

Check for a numeric value


 / Published in: JavaScript
 

URL: http://www.usamimi.info/~geko/arch_pro/0x002_js/10_isNumber/index.html

  1. function isNumber( _str,isInt)
  2. {
  3. var str,num;
  4. str = String(_str);
  5. if( isNaN( str ) )return false;
  6. num = eval( str );
  7. if( isInt==null )return true;
  8. else if( isInt )if( num!=parseInt(num) )return false;
  9. return true;
  10. }

Report this snippet  

You need to login to post a comment.