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!

I want to pass querystrings and coo 2

Status
Not open for further replies.

JordanR

Technical User
Oct 3, 2002
182
0
0
US
I want to pass querystrings and cookies to a popup window that contains a form. When the user clicks the submit button I would like for that form to close automatically or after the user sees a thank you not.
Has anyone done this before, I have tried but have come to dead end.

Any help would be appreciated.

Main concern is passing querystrings, cookies to a popup window that has all the tool bars removed.
 
add this script to your page where you want your page to be open:

<script language=&quot;JavaScript&quot; type=&quot;text/JavaScript&quot;>
function openPopup(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
</script>
<a href=&quot;javascript:eek:penPopup('YourForm.asp?query1=value1&query2=value2','YourFormName','scrollbars=yes,resizable=yes,width=150,height=150')&quot;>Open the form</a>

create a new file named YourForm.asp and here is the content:

<%
query1=request(&quot;query1&quot;)
query2=request(&quot;query2&quot;)

if request(&quot;submit&quot;)=&quot;submit&quot; then
'do whatever you want with the querys...
response.write &quot;<script>alert('Message Sent!!');window.close'</script>&quot;
end if
%>
<form action=&quot;YourForm.asp&quot; method=&quot;get&quot; name=&quot;YourForm&quot;>
<input name=&quot;query1&quot; type=&quot;text&quot; value=&quot;<%=query1%>&quot;>
<input name=&quot;query2&quot; type=&quot;text&quot; value=&quot;<%=query2%>&quot;>
<input name=&quot;submit&quot; type=&quot;submit&quot; value=&quot;submit&quot;>
</form>


Hope it's works...
 
sharedworld
The script you supplied is Awesome.
You shall receive a star.
However, the close.window didn't work.
And I think the single tic in window.close'</script> was an typo, I had to remove it to get the Alert message.


Thanks a million.
 
It should be
window.close()
or to be shure self.close()

________
George, M
 
Cool deal shaddow,
the correction worked.

Now, I will give you a star if you explain how to refresh the page that opened the popup we are closing here.

Thanks
 
Oh nooo! :)

here it is
parent.location.reload()
or self.parent.location.reload()

________
George, M
 
Shaddow,
How does parent.location.reload() fit into this script?

response.write&quot;<script>alert(my message!!!');window.close()script>&quot;
 
ok in the popuppage you should have this body tag
Code:
<body onclose=&quot;self.parent.location.reload()&quot;>
...


________
George, M
 
Ok,
that didn't work.

I have the window close script with the post to the database at the bottom of the page.
Could that be the reason?

I case you're wondering, I never learned JavaScript.
1st HTML
2nd ASP
3rd JavaScript.
I know, I've been backwards all my life.
 
Yes, you close the page just before it finishes loading.
I presume you want the popup displayed there and then click a close or something or just close itself?
If it closes itself then place that code before your windows.close().

________
George, M
 
Place it here
Code:
response.write &quot;<script>alert('Message Sent!!');self.parent.location.reload();window.close()'</script>&quot;

________
George, M
 
Why infinite loop? arent you open the popup window with a click?
Also i think i've made an mistake when using parent. Not shure if that works but should change parent with opener
Maybe the parent thing gave you the infinite loop.
Code:
self.opener.location.reload()

________
George, M
 
Here's you star!
Thanks, this worked.

response.write&quot;<script>alert(my message!!!');window.close();self.opener.location.reload()</script>&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top