2011-10-28 79 views
0

我有这个代码打开一个弹出页面。我想控制弹出窗口的大小和位置,我不确定如何更改代码来完成此操作。asp.net c中的弹出窗口的控件大小和位置#

ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>window.open('{0}');</script>", "/PopupPages/EmailPage.aspx")); 

回答

0

尝试:

ClientScript.RegisterStartupScript(this.GetType(), "newWindow", String.Format("<script>window.open('{0}', 'mywin', 'left=25, top=25, width=500, height=500');</script>", "/PopupPages/EmailPage.aspx")); 
3

您可以通过选项列表在打开的方法来指定大小等看到这个msdn article.

window.open([url], null, [options]); 

例如:

window.open("myURl.aspx", null, "height=200,width=400,status=yes,toolbar=no,menubar=no,location=no"); 
0

这是我得到的工作

ClientScript.RegisterStartupScript(this.GetType(), "newWindow", "<script>window.open('/PopupPages/EmailPage.aspx', '', 'top=100,left=300,menubar=no,toolbar=no,location=no,resizable=no,height=750,width=850,status=no,scrollbars=no,maximize=null,resizable=0,titlebar=no');</script>"); 
0

这是我做过什么:

ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Details.aspx','mywindow','menubar=1,resizable=1,width=900,height=600');", true);