Free web programmers from input verification

Source: Internet
Author: User

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:
  • Download

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.