打开新窗口并将其置于asp.net的前端 [英] opening the new window and bringing it on the front in asp.net

查看:66
本文介绍了打开新窗口并将其置于asp.net的前端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打开新窗口(浏览器)并通过按钮点击将其带到前面每当我点击它将在前面打开











opening the new window(browser) and bringing it on the front by button click whenever i clicked it will be open in front





String open = "window.open(\"AJVErrorlog.aspx?ProjectCode=" + "1200" + "&ScheduleCode=" + EncrytedString(Session["ScheduleId"] as string) + "\",'mywindow', 'height=750,width=1200, menubar=0, resizable=yes')";
       ScriptManager.RegisterStartupScript(this.ctbUpdatePanel, this.ctbUpdatePanel.GetType(), "open", open, true);

推荐答案

要打开一个窗口并始终处于活动状态,您需要将焦点设置为打开的窗口。



以下示例示例可以帮助您完成您的方案。



To open a window and to be active one always, you need to set the focus to that opened window.

Below is a sample example that can help you in your scenario.

<html>
<head>
<script>
var newWindow = null;

function openWindow()
{
    if(newWindow==null)
    newWindow = window.open("http://www.google.in", '_blank','height=750,width=1200, menubar=0, resizable=yes');

    newWindow.focus();
}
</script>
</head>
<body>
<input type="button" value="Click" onClick="openWindow()"/>
</body>
</html>



如果你不想,你需要将window.open()分配给一个全局变量单击按钮时始终打开新窗口。最后只需将焦点设置到该窗口对象。

在上面的示例中,每当您单击按钮时,它都会将打开的(如果未打开)对象放在前面。



在你的例子中,相反传递完整的窗口对象集,只将参数传递给javascript方法并用javascript方法打开window.open。



可能这个提示可以帮到你。


You need to assign the window.open() to a global variable, if you do not want to open the new window always when you click on the button. At the end just set focus to that window object.
In the above example, whenever you click on button it will bring the opened(if not open) object in front.

In your example, rather passing the complete window object set, pass only the parameters to a javascript method and open window.open there in javascript method.

May be this hint can help you.


这篇关于打开新窗口并将其置于asp.net的前端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆