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.
- <script>
- function _isInt(arg)
- { pat=/^\d+$/g;
- return pat.test(arg);
- }
- function _valid_num($arg,$min,$max,$type,$enclose)
- { if($min==undefined || $min==null) $min=0;
- if($max==undefined || $max==null) $max=9999
- 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';
- 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';
- return null;
- }
- alert(_valid_num(''));
- alert(_valid_num(''));
- </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?