Common javascript form verification summary_javascript skills

Source: Internet
Author: User
This article mainly introduces some common javascript form verification. at the end of this article, we also come with a practical case to illustrate how to verify numbers. interested friends can refer to the example to explain: verify whether the entered number is a number and whether the number is a number. if the number is incorrect, send a friendly reminder.

:

My first JavaScript

Enter a number. If the input value is not a number, a prompt box is displayed in the browser.

Script function myFunction () {var x = document. getElementById ("demo "). value; if (x = "") {alert ("input cannot be blank"); return;} if (isNaN (x )) {alert ("enter a number"); return;} if (x. length! = 6) {alert ("Please enter 6 digits"); return ;}} scriptClick here

The above example contains a lot of frequently used form verification code, which will be shared with you below:

1. verification form

2. verify the nickname

3. calculate the length of the nickname

4. verify that the nickname exists

5. verify the mobile phone number

6. verify the password

7. verify email

8. verify the verification code

9. determine whether or not to select

Registration Verification example:

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.