This program was initially modified based on the checkForm of wanghr100 (Baby gray bean. net) and added many functions, as shown below:
- Non-ie support
- Added built-in expressions and built-in prompts.
- Added display methods (pop-up and page display)
- Added one and all
- Encapsulated (CLASS_CHECK)
- Supports external functions or expressions (Consistent passwords are applied)
- The call method is simplified. For all operations, you only need to <script language = 'javascript 'src = 'checkform. js'>, and then define the tag validation formats in HTML.
- Adds restrictions on keyboard input for IE (For example, when usage = 'int' is defined, only numbers can be entered in the input box (non-IE is invalid ).)
- Added no verification for disabled.
- Custom alert method (override the showMessageEx method)
Declaration: This program can be reproduced and disseminated at will, but please keep the declaration part. Some built-in expressions are not very strict. If you have good suggestions and comments, contact me via email or leave a message on my blog
Introduction:
In this program, you only need to set three attributes for the tags to be verified:
Usage, exp, tip
- Usage: Built-in format or expression or function
- Exp: Regular Expression (ignore exp if usage is specified)
- Tip: Error message (if it is a built-in format, do not use this attribute, there is a default prompt)
You only need to reference
<Script language = 'javascript 'src = 'checkform. js'> </script>And then add the above three attributes for each tag (not necessarily all). Note that the default encoding of this js is gb2312, if your. net program is UTF-8. You can save js as UTF-8, or encode it as gb2312 in this webconfig.
Demo:
- Basic expression demonstration
- Built-in expression demonstration
- External functions and external expressions
- Demonstration of single pop-up prompt
- Custom alarm test
Download: