In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the knowledge of "how to use javascript regular expressions". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Form validation
Simple layout:
Q Q
Mobile phone
Mailbox
Landline
Name
Js Code:
CheckInput (my$ ("qq"), / ^\ d {5pm 11} $/); / / qq
CheckInput (my$ ("phone"), / ^\ d {11} $/); / / Mobile phone
CheckInput (my$ ("e-mail"), / ^ [0-9amurzAmurzZcolors. -] + [@] [0-9aMuzAmurZenzenz.-] + ([.] [a-zA-Z] +) {1jin2} $/); / / mailbox
CheckInput (my$ ("telephone"), / ^\ d {3jue 4} [-]\ d {7pm 8} $/); / / landline number
CheckInput (my$ ("fullName"), / ^ [\ u4e00 -\ u9fa5] {2pr 6} $/); / / Chinese name / / verify whether the current text box matches and displays the result through regular expression
Function checkInput (input,reg) {
/ / text box registers events that lose focus
Input.onblur=function () {
If (reg.test (this.value)) {
This.nextElementSibling.innerText= "got it right"
This.nextElementSibling.style.color= "green"
} else {
This.nextElementSibling.innerText= "Let you show off, wrong?"
This.nextElementSibling.style.color= "red"
}
}
}
That's all for "how to use javascript regular expressions". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.