Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to wait for a window pop up to close?? 1

Status
Not open for further replies.

pichi

Programmer
Nov 12, 2000
156
EC
Hi,, i am trying to do this:
i open a window pop up (window1) for selection, then when the users click the ok button,, i put some values in the parent window, and then i am trying to close the window pop up(window1),, and automatically open another window pop up (window2) without pressing another button, and getting values from the parent window,,
obviusly i dont want to open the window2 without closing the window1, how can i do it??
I have tried with a for,, but i only got my browser in a loop, and i tried to open the second window pop up from the first window pop up but i couldn't get the values from the parent window!!and then put back values in the parent window

i hope make myself clear!!
 
To answer your question, well try usng this property of a window:

window.closed returns true if window is closed

So you can write a function to detect the window status, or
add if statements to your existing ones. Like add to the window2 opening function:

if(window1Name.closed){open('window2.htm'...)}

else{}


This way the second one cannot open without the first being
closed.

Hope this helps, Ben.
 
thanks Ben, that really help me!!
but i have another problem!!! when the second window pop up opens it seems like it doesn't know where is its parent window!!, are you familiar with this behavior??can you help me,, thanks!! or somebody else!!

JP
 
Hi Ben, sorry but i made a terrible mistake, the solution you give me didn' t work!!! or I didn't understand your solution,, because,, when i close my window1 nothing happens!! the real solution would be that the code in the parent window wait for the window pop up (window1) to close, when that happens then the second window pop up must open!!
but i think your code can be used in another button!! but not in the same code that opens the first window pop up!!
i am wrong??? help me please!!!thanks anyway!!

JP
 
One of the problems is that we call the window that the pop-up came from, the opener, the parent refers to Frames pages, I am sorry, i might have given that impression!

I'll send you a sample page I made for you, it sends info from one popup to the next via the 'opener'. I think I can send it to your e-mail address, from your name link, we'll see!

Let me know if it still will not work, I have tested it this time.
NOTE: I did not even have to use the window.closed property.

Cool, see-ya, Ben
 
if you want to do something as a result of the window closing, you should capture the onUnload event:

<body onUnload=&quot;opener.openSecondWindow()&quot;></body> jared@aauser.com
 
Hi bangers, jaredn
I have tried the code you gave me, and it really works, but i have some problems,, first, let say my web development application is Lotus Domino,, second i need to return info from the window2 to the first one (first document), and third because i am using Lotus, i don't know how to write in a field text that i create without javascript!!
so!!
I tried your code,, it works!! as i said before,,although i still have problems!! (third one: i don´t know how to make reference to a text field not created with javascript, so i can put there for example the string2 in your example code) but if i can't get the code from the window2 to the parent one, then i have another problem!! and i don't know how to fix it!!

Hey guys,,thaks a lot for your help and support,, if you could help me one more time i will be really appreciated,
but if you don't know how, or is too much trouble for you!! thanks anyway!! I am just begining to understand javascript!!!sorry for bother both of you!!

Pichi
 
You can access values in window1 that you open

window1=window.open('mypage.htm')

by saying:

window1.whatever_variable_or_object_you_need

you can probably access your lotus domino

<object clsid=... id=TONY name=TONY>

by saying:

TONY.text_field_1

I really have no idea though because I have never used it jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top