Js+css the method of realizing the background darkening of Div pop-up window

Source: Internet
Author: User
Js+css How to implement a div popup with the background dimmed simultaneously Author: Code Home font: [increase   Decrease] Type: Reprint This article mainly introduces the js+css to implement Div pop-up window background dimming method, is a typical JavaScript operation pop-up window skills, with a certain reference value, the need for friends can refer to the <iframe id= "Cproiframe_u1892994_2" width= "580" height= "src=" &amp;aurl=&amp;cad=1&amp;ccd=24&amp;cec=GBK&amp;cfv=17&amp;ch=0&amp;col=zh-CN& amp;conbw=0&amp;conop=1&amp;cpa=1&amp;dai=2&amp;dis=0&amp;ltr=http%3a%2f%2fwww.jb51.net% 2farticle%2f57630.htm&amp;ltu=http%3a%2f%2fwww.jb51.net%2farticle%2f61741.htm&amp;lu_161=0&amp; Lunum=6&amp;n=jb51_cpr&amp;pcs=1201x652&amp;pis=10000x10000&amp;ps=514x135&amp;psr= 1440x900&amp;pss=1201x515&amp;qn=d5e93fc096d23b99&amp;rad=&amp;rsi0=580&amp;rsi1=90& Amp;rsi5=4&amp;rss0=%23ffffff&amp;rss1=%23f7fcff&amp;rss2=%230000ff&amp;rss3=%23444444&amp ; rss4=%23008000&amp;rss5=&amp;rss6=%23e10900&amp;rss7=&amp;scale=&amp;skin=tabcloud_skin_3 &amp;stid=5&amp;td_id=1892994&amp;titff=%e5%ae%8b%e4%bd%93&amp;titfs=12&amp;titta=left&amp;tn=text_ Default_580_90&amp;tpr=1439264178720&amp;ts=1&amp;version=2.0&amp;xuanting=0&amp;dtm=baidu _dup2_setjsonadslot&amp;dc=2&amp;di=u1892994&amp;ti=js%2bcss%e5%ae%9e%e7%8e%b0div%e5%bc%b9%e5%87% Ba%e7%aa%97%e5%8f%a3%e5%90%8c%e6%97%b6%e8%83%8c%e6%99%af%e5%8f%98%e6%9a%97%e7%9a%84%e6%96%b9%e6%b3%95_ javascript%e6%8a%80%e5%b7%a7_%e8%84%9a%e6%9c%ac%e4%b9%8b%e5%ae%b6&amp;tt=1439264178705.174.352.353 "Align=" Center,center "marginwidth=" 0 "marginheight=" 0 "scrolling=" no "frameborder=" 0 "allowtransparency=" true "></ Iframe>

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>

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.