In addition to Weibo, there is also WeChat
Please pay attention

WeChat public account
Shulou
2025-11-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Xiaobian to share with you how to use regular expressions to verify whether the login page input meets the requirements, I believe most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article. Let's learn about it!
First of all, let me show you the effect picture:
No more nonsense, just paste the code to everyone, the specific code is as follows:
(function () {$("input [name = 'uname']") .blur (function () {/ / lose focus var namestr = $(this). Val (); var regstr = / ^ [\ u4e00 -\ u9fa5] {2jue 4} $/; if (! regstr.test (namestr)) {$(this). Parent (). Next (). Html ("user name must be 2-4 Chinese characters"). Css ("color", "red"); return false } return true;}); $("input [name=' uname']") .focus (function () {/ / get focus $(this) .val (""); $(this). Parent (). Next (). Html ("); $(" input [name = 'pwd'] ") .blur (function () {var pwdstr = $(this) .blur (); var regstr = / ^\ w {6} $/) If (! regstr.test (pwdstr)) {$(this). Parent (). Next (). Html ("password must be a 6-digit underscore"). Css ("color", "red"); return false;} return true;}); $("input [name = 'pwd']") .focus (function () {$(this). Parent (). Next (). Html (");})) Blur (function () {var birthdaystr = $(this) .blur (); var regstr = / ^ (19 | 20)\ d {2}-(1 [0-2] | 0? [1-9])-(3 [0-1] | 2 [0-9] | 0? [1-9]) $/ If (! regstr.test (birthdaystr)) {$(this). Parent (). Next (). Html ("date format is incorrect"). Css ("color", "red"); return false;} return true;}); $("input [name = 'birthday']") .focus (function () {$(this). Parent (). Next (). Html (");})) $("input [name = 'email']") .blur (function () {var emailstr = $(this). Val (); var regstr = / ^ [\ w\ -] + @ [a-z0-9A-Z] + (\. [a-zA-Z] {2mer3}) {1 regstr.test 2} $/; if (! regstr.test (emailstr)) {$(this). Parent (). Next (). Html ("incorrect mailbox format"). Css ("color", "red"); return false } return true;}); $("input [name = 'email']") .focus (function () {$(this). Parent (). Next (). Html (");}); body {font-size: 12px;} # home {background-color: beige; border: solid 1px black; width: 550px; height: 185px; margin: auto; margin-top: 20px;} # head {height: 135px } # foot {text-align: center;} .dl1 {clear: both; padding-left: 10px;} .dl1 dt {float: left; height: 30px; width: 80px; line-height: 30px;} .dl1 dd {float: left; height: 30px; line-height: 30px; / * width: 250pxprospect /} # btn_res {background-image: url (img/reset.gif); width: 80px; height: 34px: } # btn_sub {background-image: url (img/submit.gif); width: 80px; height: 34px } user name: user password: date of birth: yyyy-mm-dd user email: the above is all the contents of the article "how to use regular expressions to verify whether the login page input meets the requirements". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.

The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope





About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.