Js+css the method of realizing the background dimming of div pop-up window _javascript tips

Source: Internet
Author: User

The example of this article describes the method of Js+css to implement Div pop-up windows to darken the background. Share to everyone for your reference. The implementation methods are as follows:

Copy Code code as follows:
&LT;TITLE&GT;JS+CSS implementation of the Div pop-up window, while darkening the background </title>
<script>
function Locking () {
document.all.ly.style.display= "Block";
Document.all.ly.style.width=document.body.clientwidth;
Document.all.ly.style.height=document.body.clientheight;
document.all.layer2.style.display= ' block ';
}
function Lock_checkform (theform) {
Document.all.ly.style.display= ' None ';d ocument.all.layer2.style.display= ' none ';
return false;
}
</script>
<style type= "Text/css" >
<!--
. STYLE1 {font-size:12px}
a:link {
Color: #000;
Text-decoration:none;
}
a:visited {
Text-decoration:none;
}
a:hover {
Text-decoration:none;
}
a:active {
Text-decoration:none;
}
-->
</style>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<body>
<p align= "center" >
<input type= "button" value= "pop-up div" onclick= "locking ()"/>
</p>
<div id= "ly" style= "position:absolute; top:0px; Filter:alpha (opacity=60); Background-color: #777;
Z-index:2; left:0px; Display:none; " >
</div>
<!--floating Layer framework starts-->
<div id= "Layer2" align= "center" style= "Position:absolute"; Z-index:3; Left:expression ((document.body.offsetwidth-540)/2); Top:expression ((document.body.offsetheight-170)/10);
Background-color: #fff; Display:none; ">
<table width= "540" height= "border=" 0 "cellpadding=" 0 "cellspacing=" 0 "style=" border:0 solid #e7e3e7;
Border-collapse:collapse; ">
<tr>
&LT;TD style= "Background-color: #73A2d6; Color: #fff; padding-left:4px; padding-top:2px;
Font-weight:bold; font-size:12px "height=" valign= "Middle" >
<div align= "Right" ><a href=javascript:; class= "STYLE1" onclick= "lock_checkform (this);" >[Close]</a> </div></td>
</tr>
<tr>
&LT;TD height= "130" align= "Center" >
<br><br></td>
</tr>
</table>
</div>
<!--floating Layer frame end-->
</body>

The

wants this article to help you with your JavaScript programming.

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.