showModalDialog在IE和Firefox居中

function OpenWindow(Url, Width, Height, WindowObj) {
    var iTop = (window.screen.availHeight - 20 - Height) / 2;
    var iLeft = (window.screen.availWidth - 10 - Width) / 2;
    var ReturnStr = showModalDialog(Url, WindowObj, "dialogWidth:" + Width +    "px;dialogHeight:" + Height + "px;" + "dialogTop:"+iTop+"px;"+"dialogLeft:"+iLeft+"px;"+"status:no;help:no;scroll:no;center:yes;");
return ReturnStr;
}

你可能感兴趣的:(JavaScript)