DIV/SPAN通用子視窗展現、關閉JS介面

來源:互聯網
上載者:User

標籤:style   io   ar   color   os   使用   sp   java   strong   

子視窗通用介面,基於jQuery支援使用。目前設計時,使用的是1.7.2版。FF預設焦點未失去問題存在。

HTML & JS: 

<html>    <head>        <title></title>        <script charset="GB2312" type="text/javascript" src="js/jquery-1.7.2.js"></script>        <script type="text/javascript">        var flag = true;        $(document).ready(function() {            // 確認處理            $("#butn").click(function() {                if (flag) {                    openArea("InfoWndw", "<input type=\"button\" id=\"clos\" value=\"關閉\" onclick=\"javascript:closArea(‘InfoWndw‘);\"/>MSGE CONT.", "1");                    flag = false;                } else {                    openArea("InfoWndw", "<table border=‘1‘><tr><td>HTML TABL CONT</td></tr></table>", ‘1‘  );                    flag = true;                }            });        });        // 子視窗開啟        function openArea(itemId, cont, type) {            // 鎖定背景地區顯示            $("#DVID_LOCK_VIEW").show(500);            // 視窗展示內容設定            if ("1" == type) {                // 追加內容                $("#" + itemId).append(cont);            } else if ("2" == type) {                // 設定內容                $("#" + itemId).text(cont);            } else {                // 設定HTML                $("#" + itemId).html(cont);            }            // 地區左上方上邊距            var areaTidx = 0;            // 地區左上方左邊距            var areaLidx = 0;            // 視窗高度            var wndwHigh = $(window).height();            // 視窗寬度            var wndwWdth = $(window).width();            // 地區高度            var areaHigh = $("#" + itemId).height();            // 地區寬度            var areaWdth = $("#" + itemId).width();            // 左上方起始位置計算(上邊距)            if (wndwHigh > areaHigh) {                // 視窗高度大於地區高度時,計算上邊距中間位置                areaTidx = (wndwHigh - areaHigh) / 2;            }            // 左上方起始位置計算(左邊距)            if (wndwWdth > areaWdth) {                // 視窗寬度大於地區寬度時,計算左邊距中間位置                areaLidx = (wndwWdth - areaWdth) / 2;            }//            // 各屬性節點的屬性值測試資訊//            alert("視窗:H-W : " + wndwHigh + ":" + wndwWdth + "\r\n地區:H-W : " + areaHigh + ":" + areaWdth + "\r\n位置:H-W : " + areaTidx + ":" + areaLidx);            // 左上方定位設定            $("#" + itemId).css("top", areaTidx).css("left", areaLidx);            // 地區模組顯示            $("#" + itemId).show(1000);            // 焦點移入            $("#" + itemId).focus();        }        // 子視窗關閉        function closArea(itemId) {            // 地區模組顯示            $("#" + itemId).empty();            // 地區模組顯示            $("#" + itemId).hide(500);            // 鎖定背景地區清理            $("#DVID_LOCK_VIEW").hide(1000);        }        </script>    </head>    <body>        <!--        W:<input id="wdth"/>        H:<input id="high"/>        -->        <input type="button" id="butn" value="顯示"/>        <div id="DVID_LOCK_VIEW" style="display:none;position:absolute;top:0px;left:0px;width:100%;height:100%;background-color:#336699;z-index:9998;-moz-opacity:0.6;opacity:.60;filter:alpha(opacity=60);"></div>        <span id="InfoWndw" style="position:absolute;background:#6699CC;display:none;z-index:9999;"></span>    </body></html>

 

 

LvCreator 著作權...

DIV/SPAN通用子視窗展現、關閉JS介面

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.