您的位置:首页 > Web前端 > JavaScript

JS打开新窗口代码

2010-03-09 11:35 656 查看
/*
* 打开新窗口
* f:链接地址
* n:窗口的名称
* w:窗口的宽度
* h:窗口的高度
* s:窗口是否有滚动条,1:有滚动条;0:没有滚动条
*/
function openWin(f,n,w,h,s){
sb = s == "1" ? "1" : "0";
l = (screen.width - w)/2;
t = (screen.height - h)/2;
sFeatures = "left="+ l +",top="+ t +",height="+ h +",width="+ w
+ ",center=1,scrollbars=" + sb + ",status=0,directories=0,channelmode=0";
openwin = window.open(f , n , sFeatures );
if (!openwin.opener)
openwin.opener = self;
openwin.focus();
return openwin;
}

/*
* 打开删除窗口
*/
function openDeleteDialog(url,confirmString){
var c = confirmString;
if(c == null || c == ''){
c = "你确认要删除记录吗?";
}
if(confirm(c)){
return window.showModalDialog(url,"window123","dialogHeight:234px;dialogWidth:271px;resizable:no;help:yes;status:no;scroll:no");
}
return false;
}

/*
* 删除记录
*/
function del(url,info){
if(openDeleteDialog(url,info)){
window.location.reload(true);
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  url null c