小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

js的彈出對(duì)話框

 悟靜 2013-04-05

<html>
<head>
    <title></title>
    <script type="text/javascript">
        function sAlert(str) {
            var msgw, msgh, bordercolor;
            msgw = 300;//提示窗口的寬度
            msgh = 200; //提示窗口的高度
            titleheight = 25; //提示窗口標(biāo)題寬度
            bordercolor = "#FF3C00"; //提示窗口的邊框顏色
            titlecolor = "#D2CECE";//提示窗口的標(biāo)題顏色
            var sWidth, sHeight;
            sWidth = document.body.clientWidth; //bod對(duì)象寬度
            if (window.innerHeight && window.scrollMaxY) {
                sHeight = window.innerHeight + window.scrollMaxY;
            }
            else if (document.body.scrollHeight > document.body.offsetHeight) {
                sHeight = document.body.scrollHeight;
            }
            else {
                sHeight = document.body.offsetHeight;
            } //以上得到整個(gè)屏幕的高
            var bgObj = document.createElement("div"); //創(chuàng)建一個(gè)div對(duì)象
            bgObj.setAttribute("id", "bgDiv");
            bgObj.style.position = "absolute"; //絕對(duì)定位
            bgObj.style.top = "0"; //頂部為0
            bgObj.style.backgroud = "#777"; //背景顏色
            bgObj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishiOpacity=75)"; //ie瀏覽器透明度設(shè)置
            bgObj.style.opacity = "0.6"; //透明度(火狐中)
            bgObj.style.left = "0"; //左邊為0
            bgObj.style.width = sWidth + "px";
            bgObj.style.height = sHeight + "px";
            bgObj.style.zIndex = "100"; //層的z軸位置
            document.body.appendChild(bgObj);

            var msgObj = document.createElement("div");
            msgObj.setAttribute("id", "msgDiv");
            msgObj.setAttribute("align","center");
            msgObj.style.position = "absolute";
            msgObj.style.top = "30%";
            msgObj.style.backgroud = "white";
            msgObj.style.border = "1px solid "+bordercolor;
            msgObj.style.left = "35%";
            msgObj.style.font = "12px/1.6en Verdana,Geneva,Arial,Helvetica,sans-serif";
            msgObj.style.width = msgw + "px";
            msgObj.style.height = msgh + "px";
            msgObj.style.textAlign = "center";//文本位置屬性,居中
            msgObj.style.lineHeight = "25px"; //行間距
            msgObj.style.zIndex = "101"; //層的z軸位置


            var title = document.createElement("h4"); //創(chuàng)建一個(gè)h4對(duì)象
            title.setAttribute("id", "msgTitle"); //為h4對(duì)象添加標(biāo)題
            title.setAttribute("align", "right"); //文字的對(duì)齊方式
            title.style.margin = "0"; //浮動(dòng)
            title.style.padding = "3px"; //浮動(dòng)
            title.style.backgroud = titlecolor; //背景顏色
            title.style.filter = "progid:DXImageTransform.Microsoft.Alpha(startX=20,startY=20,finishX=100,finishY=100,style=1,opacity=75,finishiOpacity=100);";
            title.style.opacity = "0.75"; //透明
            //title.style.border = "1px solid" + bordercolor;
            title.style.height = "25px"; //高度
            title.style.font = "12px Verdana,Geneva,Arial,Helvetica,sans-serif"; //字體屬性
            title.style.color = "white"; //文字顏色
            title.style.cursor = "pointer";//鼠標(biāo)樣式
            title.innerHTML = "<a href=\"#\">關(guān)閉</a>";//顯示的文字
            title.onclick = function () {
                document.body.removeChild(bgObj);//移除遮罩層
                document.getElementById("msgDiv").removeChild(title); //在提示框中移除標(biāo)題
                document.body.removeChild(msgObj);//移除提示框
            }
            document.body.appendChild(msgObj); //在body中畫出提示框?qū)?
            document.getElementById("msgDiv").appendChild(title); //在提示框中增加標(biāo)題
            var txt = document.createElement("p");
            txt.style.margin = "0";//文本浮動(dòng)
            txt.setAttribute("id", "msgTxt");//為p屬性增加id屬性
            txt.innerHTML = str;//把傳進(jìn)來(lái)的值賦給p屬性
            document.getElementById("msgDiv").appendChild(txt); //把p屬性增加到提示框中            
        }   
    </script>
</head>
<body>
<a href="#" onclick="sAlert('<a href=http://www.>測(cè)試效果</a>');">點(diǎn)擊測(cè)試</a>
</body>
</html>

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多