js实现 弹出div 并且使本页变淡,不可编辑

来源:互联网 发布:mac看图片怎么下一张 编辑:程序博客网 时间:2024/04/28 07:36

// JScript 文件

       function sAlert(str)
        {
        var msgw,msgh,bordercolor;
        msgw=400;//提示窗口的宽度
        msgh=100;//提示窗口的高度
        titleheight=25 //提示窗口标题高度
        bordercolor="#c51100";//提示窗口的边框颜色
        titlecolor="#c51100";//提示窗口的标题颜色
       
        var sWidth,sHeight;
        sWidth=screen.width;//屏幕宽
        sHeight=screen.height;//屏幕高

        var bgObj=document.createElement("div");
        bgObj.setAttribute('id','bgDiv');
        bgObj.style.position="absolute";
        bgObj.style.top="0";
        bgObj.style.background="#cccccc";
        bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75)";
        bgObj.style.opacity="0.6";
        bgObj.style.left="0";
        bgObj.style.width=sWidth + "px";
        bgObj.style.height=sHeight + "px";
        bgObj.style.zIndex = "100";
        document.body.appendChild(bgObj);
        var msgObj=document.getElementById("div1");
        msgObj.style.display = "block";
        }
       
       
        function guanbi()
        {
           var bgObj=document.getElementById("bgDiv");
           document.body.removeChild(bgObj);
          
           var msgObj=document.getElementById("div1");
           msgObj.style.display = "none";
        }