[英]how to open link in a new window and set size after page load?
I have a link with querystring like "...com/default3.aspx?id=123?code=456" This link create automatically and sending in mail as a hyperlink. 我有一个带有查询字符串的链接,例如“ ... com / default3.aspx?id = 123?code = 456”。此链接自动创建并以超链接的形式发送邮件。 I design default3.aspx page and doing some operations according to querystring. 我设计default3.aspx页面,并根据querystring做一些操作。 Is that a way open this link in a new window and set window size, after clicked from mail this link? 从邮件中单击此链接后,是否可以在新窗口中打开此链接并设置窗口大小?
I tried this but it doesn't work. 我试过了,但是没有用。
<body onload="resizeWindow()" >
...
<script type="text/javascript">
function resizeWindow()
{
// you can get height and width from serverside as well
var width=100;
var height=100;
window.resizeTo(width,height);
}
</script>
Thank you. 谢谢。
Try to open window using window.open like window.open("", "", "width=200, height=100"); 尝试使用window.open来打开窗口,例如window.open(“”,“”,“ width = 200,height = 100”);
Check out sample code at W3Schools http://www.w3schools.com/jsref/met_win_open.asp 在W3Schools http://www.w3schools.com/jsref/met_win_open.asp上查看示例代码
Check for demo using Try it yourself 使用“ 尝试一下”检查演示
I think You should use this javascript function as i have used the same code in many of my webforms and it is also tested. 我认为您应该使用此javascript函数,因为我在许多Web表单中都使用了相同的代码,并且还对其进行了测试。
window.open('Redirecturl.aspx','Graph','height=600,width=800,resizable=yes'); window.open('Redirecturl.aspx','Graph','height = 600,width = 800,resizable = yes');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.