Ajax mode form Blocker

Source: Internet
Author: User

Html

<! DOCTYPE html>

Js

functionCheckName () {varUname=document.getelementbyid ("UName")    varName=Uname.value; varMessage=uname.nextsibling; if(name.length==0) {message.innerhtml= "User name cannot be empty"//This.focus ();        return false; }Else if(name.length<4| | Name.length>10) {message.innerhtml= "User name length is between 4-10 bits"return false; }Else{message.innerhtml= "User name entered correctly"return true; }}functioncheckpwd () {varUpwd=document.getelementbyid ("Upwd"); varPwd=Upwd.value; varMessage=upwd.nextsibling; if(pwd.length==0) {Message.innertext= "User password cannot be empty"return false; }Else{Message.innertext= "User password entered correctly"return true; }}functionCheck () {if(CheckName () &&checkpwd ()) {//Send Ajax//successful operation returns true otherwise false}}

You can control the jump of a form by check the return result of this function, which is true to jump

Ajax mode form Blocker

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.