Board index » javascript » problems detecting a window
|
Dom Nicholas
Registered User |
problems detecting a window
2003-10-27 11:31:36 PM
Hi, My question is this : how do I detect from another window which didn't create a new window whether it exists ? For example, is there a window-id's container of some sort that hangs around that I can interrogate ? I would like to find a better way of doing the following. I have a window (call it Win) that creates a new window (call it Win2) using window.open(). It detects if the window already exists and brings it to the front if it does (else it just creates it). That works fine within the creator window Win. The problem occurs when I reload window Win and hit the create-window button. The Win2 window is reset and reloads from scratch. I want it to just be brought to the top. (Context :In my work what I do is have the Order button bring up an order form from an item page. Then going to another item page hitting order should not reload the order form since then all the previous item orders are thrown away - I just raise it to the top if its hidden.) ok thanks for any help. here's the code : <html> <head> <script language="javascript"> var popupwin; function NewWindow(mypage,myname) { if ( popupwin==null || popupwin.closed ) // the window doesn't exist or is closed so create it and bring it to the top { popupwin=window.open(mypage,myname,""); popupwin.focus(); } else { popupwin.focus(); // the window exists so just bring it to the top } } </script> </head> <body> <button type="button" onClick="NewWindow('www.google.com','orderform')">Order </button> </body></html> -Dom *** Sent via Developersdex www.developersdex.com *** Don't just participate in USENET...get rewarded for it! - |
