JavaScript Basics, Login front-end verification

Source: Internet
Author: User

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Landing</title>   <Linkhref=".. /static/zz.css "rel= "stylesheet"type= "Text/css">    <Script>        functionMyLogin () {varUName=document.getElementById ("name"); varUPass=document.getElementById ("UPass"); varUerror=document.getElementById ("Error_box"); if(UName.value.length<6) {uerror.innerhtml= "User name is at least 6 digits! "            }            if(UName.value.length> -) {uerror.innerhtml= "The user name can not be greater than digits! "            }            if(UName.value.length>=6&&UName.value.length<= -){                if(UPass.value.length<6) {uerror.innerhtml= "Password is at least 6 digits! "                }                if(UPass.value.length> -) {uerror.innerhtml= "The password can not be greater than digits! "                }            }        }    </Script></Head><Bodybgcolor= "#696969">    <Divclass= "box">        <H2>Login</H2>        <Divclass= "Input-box" >            <P>Please enter the user name</P>                <inputID= "Name"type= "text"placeholder= "Name">        </Div>        <Divclass= "Input_box">            <P>Please enter your password</P>                <inputID= "UPass"type= "Password"placeholder= "Password"><BR>            <ahref= "a">Forget password</a>        </Div>        <DivID= "Error_box"><BR></Div>         <Divclass= "Input_box">            <Buttononclick= "MyLogin ()">Login</Button>        </Div>    </Div></Body></HTML>
    . Box{        margin:0 auto;         Text-align:Center;         width:500px; height:300px;         Border:2px solid #D87093;         background:#FFC0CB;    }

Three ways to use <script></script>:

      1. Put in the <body>
      2. Put in the
      3. Placed in an external JS file

Three ways to output data:

      1. Use the document.write () method to write content to an HTML document.
      2. Use the Window.alert () pop-up warning box.
      3. Writes to an HTML element using InnerHTML.
        1. Use the ID property to identify the HTML element.
        2. Use the document.getElementById (ID) method to access HTML elements.
        3. Use innerHTML to get or insert element content.

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <title>Time</title></Head><Bodystyle= "Text-align:center;bgcolor:pink">    <Divstyle= "border:1px dashed #696969; width:600px;margin:0 Auto">        <h4>Current time</h4>        <PID= "Demo"></P>    </Div>    <P></P>    <Script>document.write ("hello!") document.getElementById ("Demo"). InnerHTML=Date (); </Script>    <P></P>    <Buttontype= "button"onclick=window.alert ("The user does not exist! ")>Login</Button></Body></HTML>

JavaScript Basics, Login front-end verification

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.