Div + CSS login form implementation

Source: Internet
Author: User
< Form ID = " Form1 " Runat = " Server " Action = " Index. aspx " Method = " Post " >
< Div ID = " Loginform " >
< Table >
< Tr >
< TD >
</ TD >
< TD >
< Input type = " Hidden " Value = " Login " Name = " Login "   />
</ TD >
</ Tr >
< Tr >
< TD >
User name:
</ TD >
< TD >
< Input name = " Username "   />
</ TD >
</ Tr >
< Tr >
< TD >
Password:
</ TD >
< TD >
< Input ID = " Password " Name = " Password "   />
</ TD >
</ Tr >
< Tr >
< TD >
< Input type = " Submit " Value = " Login "   />
</ TD >
< TD >
< Input type = " Reset " Value = " Cancel " Onclick = " Reset () "   />
</ TD >
</ Tr >
</ Table >
</ Div >
< Div ID = " Block " >
</ Div >
</ Form >

The last Id = block Div of form is used to block the following content.
CSS: /**/ /*Log on to form*/
# Loginform
{
Border: solid 1px # aed5fd;
Position: absolute;
Top:35%;
Left:40%;
Z-Index:2000;
Background-Color: # eaf4fe;
}
/**/ /*Shield Div*/
# Block
{
Background - Color: # cccccc;
Position: absolute;
Top: 0px;
Left: 0px;
Z - Index: 1000 ;
Display: block;
Width: 100 % ;
Height: 210 % ;
/**/ /*Sets the transparency of the blocked Div.*/
Filter: progid: DXImageTransform. Microsoft. Alpha (Enabled = True , Style = 0 , Opacity = 40 );
}

JS: Function showlogin ()
{< br> var ele = document. getelementbyid ( " loginform " );
var block = document. getelementbyid ( " block " );
ELE. style. display = " " ;< br> block. style. display = " " ;< BR >}
Function reset ()
{
Document. getelementbyid ("Loginform"). Style. Display="None";
Document. getelementbyid ("Block"). Style. Display="None";

}
Window. onload = Reset ();

Principle:
At the beginning of page loading, the login Div and the shield Div already exist, but they are only set to hide. When you click "login", the showlogin () is called to display the login and block the webpage content. Unblocking again when canceling login!

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.