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!

Pop-Up Win, automatically closing

Status
Not open for further replies.

cian

Technical User
Oct 11, 2001
1,383
I have seen this discussed before but can't find the thread.

Basically, I have a pop-up feedback form. When the visitor submits the form I need the form to close and Alert a thank you message, rather than actually redirecting to a thank you page.

For the close I have simply done:

input type="submit" value="Send" onClick="self.close()"

But how do I get the Alert? I tried adding onmouseup alert and onunload alert but they dont work. I am clusless on this subject.
Any ideas please??

Thanks guys!!!




**new site coming soon**
**don't visit just yet**
 
Add this to the <body> tag of your pop-up window:

<body onUnload=alert('Thank you!')>

 
Hi Starway!

Thanks, what I actually tried was
body onunload=&quot;javascript:alert('Thank you.etc...');&quot;
but that would not work.,
i'll give your a try.

thx again!

É **new site coming soon**
**don't visit just yet**
 
The reason your code didn't work is that you don't need the &quot;javascript:&quot; part in an event handler, since an event handler HAS to be javascript. You only need it in things like an href, where it's javascript is not expected.
Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
Ti Tracy, thanks for the explanation.
I also tried Starway's suggestion:
onUnload=alert('Thank you!')
...but that didnt work either.

Could the problem be the way I am closing the page incorporating the close into the submit button?
input type=&quot;submit&quot; value=&quot;Send&quot; onClick=&quot;self.close()&quot;

actually for the submit to work I needed to change that to &quot;onmouseup&quot;, it submits and closes but still won't alert. :(

?É **new site coming soon**
**don't visit just yet**
 
<INPUT type=submit onclick=&quot;javascript:alert('Thank You');javascript:self.close();&quot; value=&quot;Send&quot;> DeZiner
Never be afraid to try something new.
Remember that amateurs built the Ark.
Professionals built the Titanic
 
Hi Deziner,

thanks, 'fraid that didnt work either but I put that code into the body tag and changed it to onunload and that works. Thanks again!!

É

**new site coming soon**
**don't visit just yet**
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top