我在1024x768下,弹出窗体居于屏幕中心,但是在600X800下,却是不是,
有没有办法在2个分辨率下都居中?
有没有办法在2个分辨率下都居中?
解决方案 »
- cookie和Context.Cache的问题
- Page.Isvalid()怎么用?
- 关于aspx拓展名&无拓展名的问题!
- 请高手帮助---关于GridView出现的异常之解决方案2
- 通过Ajax方式返回HTML的简单方法
- >>>>>>>>>>>>>>>>>>>>>>>>>>问:如何用asp.net用向局域网的共享目录上传文件?
- 第三次发帖问这个问题了!这么多人里就没有租用过.net空间的吗?有使用过.net空间的朋友进来帮个忙!非常急!
- Javascript中,怎么引用HTML table里的一个单元格
- 很奇怪的问题,关于验证控件
- 如何在.net中应用OWC!!!急需帮助!!!
- 如何在global中取到正在request的页面的名字
- ####### 1 ,项目分析问题!2,Excel文件BS结构编辑保存问题!3, FCKeditor v1.5 问题!4,asp.net控件菜单问题!大哥们就命,后天交项
var window_top = (screen.availHeight /2) - (window_height/2);
var window_postion = "height=" + window_height +",width=" + window_width + ",left=" + window_left + ",top=" + window_top + ",scrollbars=no,status=no" ;
window.open("a.aspx","_blank",window_postion);
var window_top = (screen.availHeight /2) - (window_height/2);
var window_postion = "height=" + window_height +",width=" + window_width + ",left=" + window_left + ",top=" + window_top + ",scrollbars=no,status=no" ;
window.open("a.aspx","_blank",window_postion);
找不到screen: 找不到类型或命名空间名称“screen”(是否缺少 using 指令或程序集引用?)
var window_top = (screen.availHeight /2) - (window_height/2);
var window_postion = "height=" + window_height +",width=" + window_width + ",left=" + window_left + ",top=" + window_top + ",scrollbars=no,status=no" ;
window.open("a.aspx","_blank",window_postion);
<!--
function openwindow( url, winName, width, height)
{
xposition=0; yposition=0;
if ((parseInt(navigator.appVersion) >= 4 ))
{
xposition = (screen.width - width) / 2;
yposition = (screen.height - height) / 2;
}
theproperty= "width=" + width + ","
+ "height=" + height + ","
+ "location=0,"
+ "menubar=0,"
+ "resizable=1,"
+ "scrollbars=0,"
+ "status=0,"
+ "titlebar=0,"
+ "toolbar=0,"
+ "hotkeys=0,"
+ "screenx=" + xposition + "," //for Netscape
+ "screeny=" + yposition + "," //for Netscape
+ "left=" + xposition + "," //for IE
+ "top=" + yposition; //for IE
window.open( url,winName,theproperty );
}
//-->
</script>
怎么把上面这个错误解决
(我是放在服务器端用Response.Write()里面施行的)
出现错误:找不到screen: 找不到类型或命名空间名称“screen”(是否缺少 using 指令或程序集引用?)都说了是客户端的,你咋还这样,
StringBuilder sb = new StringBuilder();
sb.Append("<script language=javascript>");
sb.Append("window.open(\"default.htm\",null,\"status=yes,toolbar=no,menubar=no,location=no\");");
sb.Append("window.opener = null;");
sb.Append("window.close();");
sb.Append("</script>");
this.RegisterClientScriptBlock("redirectPage",sb.ToString());你把上面人家写的脚本赋给sb就可以了,
你先在客户端调通在在后台赋给一string,再response.write 或RegisterClientScriptBlock就可以了!
可以吗?
private void Page_Load(object sender, System.EventArgs e)
{
if (Session["login"]==null)
{
Response.Write("<script>window.moveTo(-9999,-9999);</script>");
Response.Write("........")
}
}
谁能给个完整的代码吗?
谢谢,我脑子不好,领会不到上面几位大虾的高招...
string url="pass.aspx";
Response.Write("ChildWindow = window.open('"+url+"', '111', 'width=340,height=190,top=220,left=220,toolbar=no,status=no,location=no,menubar=no,directories=no,scrollbars=no,resizable=no')");
Response.Write("</script>");
自己参考一下,呵呵
正确用法:
<script >
var window_left = (screen.availWidth /2) - (window_width/2);
var window_top = (screen.availHeight /2) - (window_height/2);
var window_postion = "height=" + window_height +",width=" + window_width + ",left=" + window_left + ",top=" + window_top + ",scrollbars=no,status=no" ;
window.open("a.aspx","_blank",window_postion);
</scirpt>
那样的话我不是返回首页就要登陆??我放到cs中是为了方便用session判断有没有登陆过,登陆过就不弹出登陆小窗口,反之,出先弹出小登陆窗口,并且不论在1024x768还是800X600下都能居屏幕中间.