//打开模式窗口 function OpenDialog(url, width, height) { var sRet; var params = "dialogWidth:" + width + "px;dialogHeight:" + height + "px;center:yes;status:no;help:no"; sRet = showModalDialog(url, window, params); if (sRet == "refresh") { window.location.reload(); } }
url 是地址 width是高 height 是宽
请问这个这门改啊
我试了这样的 获取屏幕的宽和高
var sRet;
var bwidth = window.screen.height;
var bheight = window.screen.availWidth;
var w_sp = (bwidth - width) / 2;
var h_sp = (bheight - height) / 2;
var params = "dialogWidth:" + w_sp + "px;dialogHeight:" + h_sp + "px;center:yes;status:no;help:no";
这样做不行
function OpenDialog(w_sp1, h_sp1) {
var url = "css.aspx";
var iTop2 = (window.screen.availHeight - 20 - h_sp1) / 2;
var iLeft2 = (window.screen.availWidth - 10 - w_sp1) / 2;
var params = 'menubar:no;dialogHeight=' + h_sp1 + 'px;dialogWidth=' + w_sp1 + 'px;dialogLeft=' + iLeft2 + 'px;dialogTop=' + iTop2 + 'px;resizable=yes;scrollbars=0;resizeable=0;center=yes;location:no;status:no'
window.showModalDialog(url, window, params);
} 设置位置是dialogLeft,dialogTop两个属性
这个可以 谢谢 朋友
获取屏幕宽度,可以使用
var clientScreen =
{
width : window.screen.width ,
height : window.screen.height
};