something that doesn't really related to jQuery but i have decided to post here.

something that doesn't really related to jQuery but i have decided to post here.

it's nothing to do with jQuery, so it doesn't required any jQuery plugin.
  1. <script>
  2. function _isInt(arg)
  3. { pat=/^\d+$/g;
  4. return pat.test(arg);
  5. }

  6. function _valid_num($arg,$min,$max,$type,$enclose)
  7. { if($min==undefined || $min==null) $min=0;
  8. if($max==undefined || $max==null) $max=9999

  9. if($min!='' && !_isInt($min)) throw 'Invalid value, _valid_num($arg,min=0,$max=9999,$type=\'int\',$enclose=true): $min should be integer,empty string or null';
  10. if($max!='' && !_isInt($max)) throw 'Invalid value, _valid_num($arg,min=0,$max=9999,$type=\'int\',$enclose=true): $max should be integer,empty string or null';

  11. return null;
  12. }
  13. alert(_valid_num(''));
  14. alert(_valid_num(''));
  15. </script>
open with google chrome and check on inspect element.

There is an error message:
Uncaught Invalid value, _valid_num($arg,min=0,$max=9999,$type='int',$enclose=true): $max should be integer,empty string or null
This mean that $max is not an integer. So i try this 2 step.
1. set alert($max) on line 10,it show 9999 as default value, nothing wrong!
2. remove 1 of the alert(_valid_num('')); on line 17 or 18 and run it again. it doesn't show any error~

Could someone tell me what is going on?