Div pop-up logon window

Source: Internet
Author: User
<Meta charset = "UTF-8"/> <SCRIPT type = "text/JavaScript"> // pop-up login function showno () // hide two layers {document. getelementbyid ("doing "). style. display = "NONE"; document. getelementbyid ("divlogin "). style. display = "NONE";} function $ (ID) {return (document. getelementbyid )? Document. getelementbyid (ID): Document. all [ID];} function showfloat () // display two layers based on the screen size {var range = getrange (); $ ('doing '). style. width = range. width + "PX"; $ ('doing '). style. height = range. height + "PX"; $ ('doing '). style. display = "Block"; document. getelementbyid ("divlogin "). style. display = "";} function getrange () // obtain the screen size {var Top = document. body. scrolltop; var left = document. body. scrollleft; Var Height = document. body. clientheight; var width = document. body. clientwidth; If (Top = 0 & left = 0 & Height = 0 & width = 0) {Top = document.doc umentelement. scrolltop; left = document.doc umentelement. scrollleft; Height = document.doc umentelement. clientheight; width = document.doc umentelement. clientwidth;} return {top: Top, left: Left, height: height, width: width };}// this is a self-written logon method, If you want to use this function, modify login () {var username = document. getelementbyid ("txtusername "). value; var Pwd = document. getelementbyid ("txtpwd "). value; If (username = "" | Pwd = "") {alert ("Enter the user name or password"); return;} var DIV = document. getelementbyid ("userinfo"); var XMLHTTP = getxmlhttpobject (); // specify the callback function XMLHTTP. onreadystatechange = function () {If (XMLHTTP. readystate = 4 & XMLHTTP. status = 200 ){ M = XMLHTTP. responsetext; If (M = "0") {alert ("incorrect user name or password");} else {MSG = m; Div. innerhtml = "<a href = '.. /musicsite/membercenter. aspx 'target = '_ blank'> "+ M +" </a> "; Div. setattribute ("class", "mid"); showno () ;}}; // initialize xmlhttprequst XMLHTTP. open ("Post", "login. aspx ", true); // sets the header XMLHTTP. setRequestHeader ("Content-Type", "application/X-WWW-form-urlencoded"); // send data var DATA = "username =" + Escape (username) + "& Pwd =" + escape (PWD); XMLHTTP. Send (data) ;}</SCRIPT> <! -- The following is the code written in HTML --> <! -- This is your logon button --> <a href = "#" onclick = "showfloat ()"> logon </a> <! -- Pop-up logon ---> <! -- Add a translucent layer --> <Div id = "doing" style = "filter: alpha (opacity = 30);-moz-opacity: 0.3; opacity: 0.3; background-color: #000; width: 100%; Height: 100%; Z-index: 1000; position: absolute; left: 0; top: 0; display: none; overflow: hidden; "> </div> <! -- Add a logon layer --> <Div id = "divlogin" style = "border: solid 10px #898989; Background: # FFF; padding: 10px; width: 400px; z-index: 1001; Height: 200px; position: absolute; display: none; top: 50%; left: 50%; margin:-200px 0 0-200px; "> <Div style =" padding: 3px 15px 3px 15px; text-align: Left; Vertical-align: middle; "> <div> Username: <input type = "text" style = "border: 1px solid #898989; Height: 20px;" id = "txtusername"/> <br/> password: <input type = "password" style = "border: 1px solid #898989; Height: 20px; margin-left: 10px;" id = "txtpwd" onkeydown = "If (event. keycode = 13) {login () ;}"/> </div> <br/> <Div style = "text-align: center;"> & nbsp; & nbsp; <input type = "button" id = "bttlogin" value = "login" onclick = "login ();"/> & nbsp; <input type = "button" id = "bttcancel" value = "cancel" onclick = "showno ()"/> </div>

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.