JavaScript Form Verification

Source: Internet
Author: User

1. form number range Verification:





















<Script type = "text/javascript">Function check_num_value (obj_name, obj, minvalue, maxvalue ){Var reg =/^ [0-9] + $ /;If (obj. value! = ""&&! Reg. test (obj. value )){Alert (obj_name + 'can only enter numbers! ');Obj. value = "";Obj. focus ();Return false;} Else if (minvalue> obj. value | obj. value> maxvalue ){Alert (the range of obj_name + "is" + minvalue + "-" + maxvalue + "! ");Obj. value = "";Obj. focus ();Return false;}}</Script>

Latitude:
360) {this. value = 360;} ">& Nbsp; degree & nbsp;
& Nbsp; points & nbsp;
>& Nbsp; seconds

Ii. Email Verification

The indexOf () method of the String object returns the starting position of the String passed in through the parameter, and the mailbox address must be similar to the structure of the username@website.com, in the user-submitted String marked as the mailbox address, through indexOf ("@") and indexOf (". ") the return value of the method can determine the validity of the email address. Test the following code:

<Script language = "JavaScript" type = "text/javascript">

</Script>









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.