JS+CSS實現Div快顯視窗同時背景變暗的方法

來源:互聯網
上載者:User
JS+CSS實現Div快顯視窗同時背景變暗的方法 作者:代碼家園 字型:[ 增加  減小] 類型:轉載 這篇文章主要介紹了JS+CSS實現Div快顯視窗同時背景變暗的方法,是一款比較典型的javascript操作快顯視窗的技巧,具有一定參考借鑒價值,需要的朋友可以參考下 <iframe id="cproIframe_u1892994_2" width="580" height="90" src="http://pos.baidu.com/acom?adn=3&amp;at=231&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>

本文執行個體講述了JS+CSS實現Div快顯視窗同時背景變暗的方法。分享給大家供大家參考。具體實現方法如下:

複製代碼代碼如下: <html>
<head>
<title>JS+CSS實現的Div快顯視窗,同時背景變暗</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';document.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">
</head>
<body>
    <p align="center">
        <input type="button" value="彈出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>
    <!--          浮層架構開始         -->
    <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="300" border="0" cellpadding="0" cellspacing="0" style="border: 0    solid    #e7e3e7;
             border-collapse: collapse ;" >
            <tr>
                <td style="background-color: #73A2d6; color: #fff; padding-left: 4px; padding-top: 2px;
                     font-weight: bold; font-size: 12px;" height="10" valign="middle">
                     <div align="right"><a href=JavaScript:; class="STYLE1" onclick="Lock_CheckForm(this);">[關閉]</a>     </div></td>
            </tr>
            <tr>
                <td height="130" align="center">
<br><br><hr><p align="center"><font color=red>本特效收集於互連網,只為興趣與學習交流,不作商業用途。來源:指令碼之家</font></p>
                </td>
            </tr>
        </table>
    </div>
    <!--  浮層架構結束-->
</body>
</html>

相關文章

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.