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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

submit opens popup, popup closes when next page loads 1

Status
Not open for further replies.

schase

Technical User
Sep 7, 2001
1,756
0
0
US
Hi all,

I have an ASP page that takes a bit to process between the form page to the next page.

I need to popup a window upon submit, that stays open
until the next page body loads.

I know how to launch a window with submit like so

swindow=window.open('load.htm', 'smallWindow', 'width=200,height=200');

And it works great, but how do I then reference that popup window on the next page and close it?

Thank you
"Never underestimate the power of determination"

Stuart
 
ok there may be an easier way to do this, but here's what I came up with.

On both the page that opens the popup and the page that submit takes you to - add to the <head>:

<script>
self.name = &quot;myWindow&quot;;
self.myObject = new Object();
</script>

In the <body> of both pages add:

<form name=&quot;form1&quot;>
<input type=&quot;hidden&quot; name=&quot;hf&quot; value=&quot;live&quot;>
</form>

In the page that submit takes you to change value=&quot;live&quot; to value=&quot;kill&quot;

Now in the code that makes up the popup window (load.htm in your example) put this code in the <head>:

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
function winKill() {
myTop = window.open(&quot;&quot;, &quot;myWindow&quot;);
if (!myTop.myObject) {
myTop.close();
} else {
closer = myTop.document.form1.hf.value;
if (closer==&quot;kill&quot;) {
self.close()
}
setTimeout('winKill()',1000)
}
}
</script>

and add the onload handler (to the popup code):

<body onLoad=&quot;winKill()&quot;>

 
perfect,

Thank you very much &quot;Never underestimate the power of determination&quot;

Stuart
 
you're very welcome - thank you for the purple star (it's my first one!)

var atFirst='developer.succeed=true'
if(eval(atFirst)){
celebrate()
} else {
tryAgain()
}
 
Hey LAwebTek

we finally put it up on the server for production use - and for some reason - the little window pops up like it should and all - but when that submit to page loads - wham up pops a dialog box saying its trying to close. you hit ok and it closes out the page your submitting too - leaving the little popup window still there.

Any ideas?

thank you &quot;Never underestimate the power of determination&quot;

Stuart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top