Javascript window.open()不是';t开口,高度我通过它
我试图在窗口上设置Javascript window.open()不是';t开口,高度我通过它,javascript,c#,asp.net,Javascript,C#,Asp.net,我试图在窗口上设置height=200和width=200,但我得到的只是标准页面大小。我试过其他的高度和宽度尺寸,但它总是打开相同的尺寸 代码如下: Page.ClientScript.RegisterClientScriptBlock( Page.GetType(), "cadastrarProduto", "window.open('CadastroProduto.aspx','height=200, width=200',false)", true)
height=200
和width=200
,但我得到的只是标准页面大小。我试过其他的高度和宽度尺寸,但它总是打开相同的尺寸
代码如下:
Page.ClientScript.RegisterClientScriptBlock(
Page.GetType(),
"cadastrarProduto",
"window.open('CadastroProduto.aspx','height=200, width=200',false)",
true);
地籍Produto是我选择的字符串键。
CadastroProduto.aspx是我用脚本重定向的页面
我正在尝试在asp.net上这样做,如果有更好的方法弹出一个我想知道的窗口
window.open(URL, name, specs, replace)
名称是可选的。它可以是空的。
因此,使用一个空白参数,然后添加高度值
window.open('CadastroProduto.aspx',' ','height=100, width=100',false)
试试看,会有用的
Response.Write(“window.open”(“+”CadastroProduto.aspx)”+
“,”空白“,”工具栏=是,宽度=100,高度=100');”;
您似乎缺少name参数(第二个-它是可选的,但这意味着您可以传递空值,而不仅仅是跳过它)。
引述如下:
可选。指定窗口的目标属性或名称。
支持以下值:
_blank - URL is loaded into a new window. This is default
_parent - URL is loaded into the parent frame
_self - URL replaces the current page
_top - URL replaces any framesets that may be loaded
name - The name of the window (Note: the name does not specify the title of the new window)
您需要像这样传递一个空白参数:
window.open('CadastroProduto.aspx','','height=100,width=100',false)
Ahhh verdade,obrigado<代码>窗口。打开是个坏主意。许多浏览器、病毒扫描程序和弹出窗口拦截器都会阻止它。最好使用情态动词。
_blank - URL is loaded into a new window. This is default
_parent - URL is loaded into the parent frame
_self - URL replaces the current page
_top - URL replaces any framesets that may be loaded
name - The name of the window (Note: the name does not specify the title of the new window)