我是在.cs中这样写的Button1.Attributes.Add("onclick", "javascript:window.open('ProductsQuotationUpLoad.aspx?ProjectNo=" + ProjectNo + "&BaoJiaDanID=" + HDFBaoJiaDanID.Value + "&FileTypeID=44,45','new1','width=950,height=100,menubar=no,scrollbars=no, resizable=no,location=no,status=no,top=200,left=(screen.AvailWidth - 950) / 2')");
运行后HTML源码如下<input type="submit" name="GridView1$ctl02$Button1" value="文件上传" onclick="javascript:window.open('ProductsQuotationUpLoad.aspx?ProjectNo=B41193001&BaoJiaDanID=B41193001-TSBJ20090908171709&FileTypeID=44,45','new1','width=950,height=100,menubar=no,scrollbars=no, resizable=no,location=no,status=no,top=200,left=(screen.AvailWidth - 950) / 2');" id="GridView1_ctl02_Button1" />
为何弹出的页面还是不能居中显示呢?还是居左显示
运行后HTML源码如下<input type="submit" name="GridView1$ctl02$Button1" value="文件上传" onclick="javascript:window.open('ProductsQuotationUpLoad.aspx?ProjectNo=B41193001&BaoJiaDanID=B41193001-TSBJ20090908171709&FileTypeID=44,45','new1','width=950,height=100,menubar=no,scrollbars=no, resizable=no,location=no,status=no,top=200,left=(screen.AvailWidth - 950) / 2');" id="GridView1_ctl02_Button1" />
为何弹出的页面还是不能居中显示呢?还是居左显示
解决方案 »
- farpoint 限制拖动列头 在线等
- gridview 循环插入
- 如何去除字符串中所有的英文字母??
- 不能理解javascript:history.go(-1)
- 一个简单的asp.net 链接问题求教
- 求救,要疯了,导出EXCEL和WORD时出现乱码
- 动态显示DataGrid中的列,怎么实现????求救!!!!
- 给DropDownlist绑定一个客户端事件,为什么客户端事件返回为true了,而不执行服务器端事件了?
- 高手能否详细谈一下asp.net下的安全机制
- ASP.Net必须编译吗?
- session 保存对象的问题
- 我要把一个长字符串中间的多个空格替换成一个空格是怎么实现?注意哦,不是两头的空格
把它写在 一个函数里吧,然后在后台用Button注册这个脚本
{
if (url==''){
return false;
} if (nwin && !nwin.closed){
nwin.close();
}
if (sSize == undefined) {
alert("请指定窗口型号!");
return false;
}
else if (sSize == 100) {
sWidth = screen.availWidth;
sHeight = screen.availHeight;
} else if (sSize == 1) {
sWidth = 280;
sHeight = 120;
}
else if (sSize == 2) {
sWidth = 600;
sHeight = 400;
} var l = ( screen.availWidth - sWidth ) / 2;
var t = ( screen.availHeight - sHeight ) / 2;
nwin = window.open(url,sTitle,'left=' + l +',top=' + t +',width='+sWidth+',height='+sHeight+',scrollbars=yes,resizable=yes');
nwin.focus();
}
</script>
调整它的 left height top 高度即可。