In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you the "regular expression how to carry out page form verification function", the content is easy to understand, well-organized, hope to help you solve your doubts, the following let the editor lead you to study and learn "regular expression how to page form verification function" this article.
In general, when you complete the registration page, when users fill in the information, they need to verify their information, which requires regular expressions, as shown in the following example.
Effect picture: (displays an error prompt when the information filled in by the user does not conform to the specification)
I only provided the html structure and js, the style you write according to your own design draft, I add different class to the right time and the wrong time, using different heights, correct is small, you can hide the scarlet letter of the prompt.
Html structure:
Registration letter beginning, length 5-10 digits alphanumeric underscore alphanumeric length 6-18 digits twice password inconsistent phone number incorrect mailbox format incorrect certificate format incorrect please enter the password first
Js:
/ / regular expression begins and ends with a double slash. The limit must begin with what must be preceded by ^, and the restriction must end with what must be followed by $, for example: / ^ regular $/ var reg = {user:/ ^ [a-zA-Z]\ w {4 a-zA-Z} $/, / to determine the user name. The first digit cannot be a number, that is, lowercase letters or uppercase letters. The following content\ w represents characters (numeric underscore) / / requires 5-10 characters, so to get out of the first place, you also need 4-9 digits of\ w pwd:/ ^ [\ da-zA-Z] {6pm 18} $/, / to judge the password. The html structure requires numeric characters 6 to 18 digits. \ d means the number tel:/ ^ 1 [34578]\ d {9} $/, / / is used to determine the phone number. Usually, the first digit of the mobile phone number is 1, and the second digit can only appear 3.4.5.7.8. The remaining 9 digits are randomly mail:/ ^ [1-9aMusz Amurz ZZ]\ wrights @ [a-zA-Z0-9] + (\. [a-zA-Z] {2,}) + $/, / / to determine a mailbox. Usually the mailbox does not start with 0, so the first digit is a 1-9 number or lowercase or uppercase letter. The second bit starts with any character / / or there can be only the first bit without the second bit, * indicates at least 0, followed by @, lowercase letters or uppercase letters or numbers. Need to change the meaning character, so write as\. The / / dot is usually followed by com or cn or com.cn, so it is a lowercase letter or uppercase letter at least two digits IDCard:/ ^ [1-9]\ d {16} [\ dxX] $/, / / is used to judge the ID card, usually the first digit is not zero, so take the number from 1 to 9, the 16 digits in the middle are random, and the last digit is either a number or X} Var arr = [document.getElementsByName ('user') [0], document.getElementsByName (' pwd') [0], document.getElementsByName ('tel') [0], document.getElementsByName (' mail') [0], document.getElementsByName ('IDCard') [0]]; for (var iTuno
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.