少年阿賓

          那些青春的歲月

            BlogJava :: 首頁 :: 聯(lián)系 :: 聚合  :: 管理
            500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
          <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
          <html>
          <head>
          <title>js run</title>
          </head>
          <style type="text/css">
          .div1 {
          background-color: #555555;
          position: absolute;
          top: 0;
          left: 0;
          z-index: 1;
          display: none;
          filter: Alpha(opacity =             30);
          }
          .div2 {
          width: 300px;
          height: 200px;
          position: absolute;
          z-index: 2;
          display: none;
          border: 3px inset blue;
          background-color: #9999CC;
          }
          </style>
          <script type="text/javascript">
          //顯示的方法,說明:前綴的div1、div2、body等,均為Id值 
          function show() {
          div1.style.display = "inline";
          //設(shè)置層1顯示 div1.style.width=body.clientWidth;
          //設(shè)置層1寬度等于body寬度,width=100%也可以,不過有一些誤差,所以最好用這個 
          div1.style.height = body.clientHeight;
          //設(shè)置層1高度滿屏 
          div2.style.display = "inline";
          //設(shè)置層2的顯示
          div2.style.top = body.clientHeight / 2 - div2.clientHeight / 2;
          //設(shè)置層2的距頂位置居中算法 
          div2.style.left = body.clientWidth / 2 - div2.clientWidth / 2;
          //設(shè)置層2的距左位置居中算法 
          }
          //關(guān)閉顯示 
          function closeShow() {
          div1.style.display = "none";
          div2.style.display = "none";
          }
          </script>
          <body bgcolor="#C0C0C0" id="body">
          <!--測試按鈕點(diǎn)擊觸發(fā)show()方法-->
          <input type="button" value="測試按鈕" onClick="show()" />
          <div id="div1" class="div1"></div>
          <!--這是要覆蓋網(wǎng)頁的層,不必寫任何東西-->
          <div id="div2" class="div2">
          <!--這是彈出的模式窗口層-->
          <!--嵌套在層中的層,用來做標(biāo)題欄,按個人需求定義-->
          <div id="div3"
          style="width: 100%; height: 20px; background-color: #0099FF"
          align="right">
          <label onClick="closeShow()"
          style="font-weight: bolder; cursor: hand"> 關(guān)閉 <!--用來關(guān)閉顯示,在label中加了onclick事件,與鼠標(biāo)懸停手的樣式-->
          </label>
          </div>
          <input type=text> </br> <input type=text>
          </div>
          </body>
          </html>
          posted on 2011-12-19 16:42 abin 閱讀(512) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 城固县| 盈江县| 同心县| 东至县| 安阳市| 广西| 饶平县| 承德市| 中江县| 秀山| 图们市| 民权县| 永川市| 蛟河市| 吉首市| 咸宁市| 罗甸县| 托克逊县| 中阳县| 中西区| 从化市| 荔波县| 金溪县| 利辛县| 朝阳县| 张掖市| 怀化市| 富阳市| 托里县| 宜城市| 星座| 鄢陵县| 鄯善县| 阳谷县| 舟曲县| 红桥区| 湖口县| 东平县| 蒙山县| 永昌县| 澎湖县|