屏幕变灰

    <script type="text/javascript">
        //调用: new NeatDialog(sHTML, sTitle, true);
    function NeatDialog(sHTML, sTitle, bCancel) {
        window.neatDialog = null;
        this.elt = null;
        if (document.createElement && document.getElementById) {
            var dg = document.createElement("div");
            dg.className = "neat-dialog";
            if (sTitle)
                sHTML = '<div class="neat-dialog-title">' + sTitle + ((bCancel) ? '<img src="http://images.cnblogs.com/close1.png" alt="Cancel" id="nd-cancel"  class="nd-cancel" />' : '') + '</div>\n' + sHTML;
            dg.innerHTML = sHTML;

            var dbg = document.createElement("div");
            dbg.id = "nd-bdg";
            dbg.className = "neat-dialog-bg";

            var dgc = document.createElement("div");
            dgc.className = "neat-dialog-cont";
            dgc.appendChild(dbg);
            dgc.appendChild(dg);

            dgc.style.width = document.body.scrollWidth;
            dgc.style.height = document.body.scrollHeight;

            document.body.appendChild(dgc);
            if (bCancel)
                document.getElementById("nd-cancel").onclick = function () {
                    window.neatDialog.close();
                };
            this.elt = dgc;
            window.neatDialog = this;
        }
    }
    NeatDialog.prototype.close = function () {
        if (this.elt) {
            this.elt.style.display = "none";
            this.elt.parentNode.removeChild(this.elt);
        }
        window.neatDialog = null;
        time = null;
    }
    function c() {
        if (window.neatDialog)
            window.neatDialog.close();
    }
    window.onresize = function () {
        if (window.neatDialog) {
            window.neatDialog.elt.style.width = document.body.scrollWidth;
            window.neatDialog.elt.style.height = document.body.scrollHeight;
    }
    }
</script>
    <style type="text/css">
    .neat-dialog-cont
    {
    z-index: 98;  left: 0px; position: absolute; top: 0px;
    }
    .neat-dialog-bg
    {
    z-index: -1; filter: alpha(opacity=30); left: 0px; width: 100%; position: absolute; top: 0px; height: 100%; background-color: #000000; opacity: 0.3;
    }
    .neat-dialog
    {
    border: #444 1px solid;z-index: 99; margin-left: auto;width: 30%; margin-right: auto; position: relative; top: 25%; background-color: #fff; padding-bottom:5px;
    }
    .neat-dialog-title
    {
    padding:0 0.3em 0.1em 0.3em; font-size:0.9em; margin: 0px; line-height: 1.6em; border-bottom: #444 1px solid;  background:#2EB3DF; color:White; cursor:move;
    }
    .nd-cancel
    {
    right: 0.2em; position: absolute; top: 0.1em
    }
    .neat-dialog p
    {
    padding: 0.2em; text-align: center;
    }
</style>

posted @ 2011-03-30 16:45  Microbar  阅读(318)  评论(0编辑  收藏  举报