showModalDialog 跳出後背景灰階的語法

function GridView_OpenDialog2(url, widthpx, heightpx, imgurl) {

    var dialogcenter = ";dialogTop:" + ((window.screen.height / 2) - (heightpx.replace("px", "") / 2)) + " ; dialogLeft:" + ((window.screen.width / 2) - (widthpx.replace("px", "") / 2)) + ";";
    if (imgurl) {
        var mask = document.createElement("DIV");
        mask.id = "GridView_mask";
        var style = "";
        style += "background-color:white;";
        style += "width:100%; height:100%;";
        style += "position:fixed; top:0; left:0; zindex:1000;";
        style += "filter:alpha(opacity=70); opacity:0.7; zoom:1;-moz-opacity:0.7;";
        mask.style.cssText = style;
        //=======下面這些只有IE支援不建議這樣使用
        //mask.style.position = "fixed";
        //mask.style.top = 0;
        //mask.style.left = 0;
        //mask.style.width = "100%";
        //mask.style.height = "100%";
        //mask.style.zIndex = 1000;
        //mask.style.backgroundColor = "white";
        //mask.style.filter = "Alpha(Opacity=70);";
        mask.innerHTML = "";
        document.body.appendChild(mask);
    }
    var retvar = showModalDialog(url, self, "dialogWidth:" + widthpx + ";dialogHeight:" + heightpx + ";resizable:yes;scroll:yes;status:no;" + dialogcenter) != null;

    if (imgurl) {
        document.body.removeChild(mask);
    }
}

留言