javascript popwind windoe着重于页面回发 [英] javascript popup windoe focus on page postback

查看:146
本文介绍了javascript popwind windoe着重于页面回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经从parent.aspx页面打开了弹出页面child.aspx.

Hi,

I have opened popup page child.aspx from parent.aspx page.

var win = null; 
function OpenNewWindow(){
 if (win != null) {
                win.window.focus();
 else {
      win = window.open("child.aspx", "RealTimeReport", settings)
}
}



我只想在第一次单击时打开新窗口,之后才应将焦点放在已打开的窗口上.

当我多次单击链接时,它会起作用.

但是在父页面的回发中,win对象设置为null,
并单击链接将不会关注先前打开的窗口,而是打开新窗口.

我想在回发时保留以前打开的窗口实例.


请帮助我



I want to open new window on first time click only after that it should focus on already opened window.

It works when I click on link more than once.

But on postback in parent page win object set to null,
and click on link won''t focus on previously opened window,It open new window instead.

I want to retain previously opened window instance on postback.


Please help me

推荐答案

这是正确的行为,因为当重新加载页面时,浏览器将释放关于Java脚本的所有当前状态.我听说过类似于客户端会话存储的内容,但是我不确定是否可以将其用于存储javascript对象.
我的建议是发送回打开的弹出窗口的状态信息,通过回发关闭页面时关闭弹出窗口,并需要在该回发请求中重新打开弹出窗口时生成不必要的javascript服务器端. >
干杯!

--MRB
That is the correct behavior as the browser will loose all current state in regard to java script when the page is reloaded. I''ve heard about something akin to client side session storage, but I''m not sure if it could be used to store javascript objects.
My advice to you is to send back the state information of the popup being open, close the popup when the page is being closed via the postback and generate the nescessary javascript serverside when the popup needs to be reopened on that postback request.

Cheers!

--MRB


这篇关于javascript popwind windoe着重于页面回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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