Ajax页面中的弹出窗口 [英] Popup in ajax page

查看:142
本文介绍了Ajax页面中的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在尝试制作一个需要打开弹出窗口的应用程序,这是一个在线游戏网站.我从中打开弹出窗口的页面是Tournament.aspx,这是一个启用了Ajax的页面.我在页面Tourna.aspx中单击坐下"按钮,打开带有游戏的弹出窗口.

我正在使用以下代码打开弹出窗口

sb.Append("window.open(``popuppage.aspx'','''',''width = 500,height = 550,menubar = no,resizable = yes,scrollbars = yes'');");
ScriptManager.RegisterClientScriptBlock(this.btnTakeSeat,this.GetType(),"hello",sb.ToString(),true);


但是使用此代码,每次单击按钮都会打开一个新的弹出窗口.

我想要多个弹出窗口,但是具有ID的弹出窗口在关闭之前不应该再次打开

有什么方法可以检查与ID对应的弹出窗口是否打开

谢谢

Nidhin

Hi
I''m trying to make an application in which i need to open popups, this is an online gaming site. The page from which i''m opening popups is tournament.aspx, this is an ajax enabled page. I''m opening the popup window with a game on the click of ''Take your seat'' button in the page tournament.aspx.

I''m using the following code for opening the popup

sb.Append("window.open(''popuppage.aspx'','''',''width=500, height=550,menubar=no,resizable=yes,scrollbars=yes'');");
ScriptManager.RegisterClientScriptBlock(this.btnTakeSeat, this.GetType(), "hello", sb.ToString(), true);


But using this code, a new popup window will be opened for each button click.

I want multiple popups, but the popup with an id should not be opened again until it is closed

Is there any way to check whether the popup corresponding to an id is open

Thanks

Nidhin

推荐答案

我找不到分配给创建的新窗口的任何ID!
试试这个:
I don''t find any ID assigned to the new windows created!
Try this:
sb.Append("var myWin = window.open(''popuppage.aspx'','''',
''width=500, height=550,menubar=no,resizable=yes,scrollbars=yes'');");
ScriptManager.RegisterClientScriptBlock(this.btnTakeSeat, 
                      this.GetType(), "hello", sb.ToString(), true);


现在,单击此按钮将只打开一个窗口.如果再次按,它将在同一窗口中重新打开.

如果需要,请在此处查看有关它的更多详细信息: MSDN:打开方法 [ ^ ]


Now only one window will be opened at this button click. If you press again, it will re-open in the same one.

Look here for more details on it, if needed: MSDN: open Method[^]


为此,您可以在父页面上为每个id设置一个标志.默认情况下,将其设置为false.每当打开弹出窗口时,将其设置为true,而在关闭时将其设置为false.请始终检查该标志在打开弹出窗口之前,仅当它为false时才打开它.
For that you can have a flag for each id on parent page.By default set it false .Whenever you open a popup,set it true and when close set it false.Always check the flag before opening popup,open it only when it is false.


如何知道弹出窗口是否已关闭.如何在asp页面中获取弹出窗口
How do i know whether the pop has closed..how do i get it in the asp page


这篇关于Ajax页面中的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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