pe**************@yahoo.com (Person) writes:
I have a popup window with a form:
The popup window is opened like this:
<SCRIPT LANGUAGE=javascript>
The "type" attribute is required. This should be
<script type="text/javascript">
window.open('primos.html', 'primos', config='height=300, width=400')
The "config=" is not necessary. The config string should not contain spaces,
some browsers choke on them.
</SCRIPT>
The form on the popup window is this:
<form action="primos.php" method="POST">
.... How can I get the form to send the info to "primos.php" and open it in
the original window?
How do you know that the original window is still open?
If it is open, you can use the target attribute on the form tag to send
the result to that window. This requires you to know the name, if any,
of the original window.
There is a way to find this name (or set it, if there is no name)
dynamically:
<form action="primos.php" method="POST" target="_blank"
onsubmit="if (!opener.closed) {
if (opener.name) {this.target=opener.name;}
else {
this.target = opener.name =
'primosWindowName'+Math.floor(Math.random()*10000) ;
}}">
If the original window exists, then we either set the target attribute
to that window's name. If it has no name, we create a new, random, name
and assign it to both the target attribute and the window's name.
Warning, untested code. I did test that you can set the window's name
dynamically in Opera 7, Mozilla and IE 6.
This will probably fail if the user has navigated the original window
away from your pages and onto a new domain.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'