Closing Popup After Submit to opener

T

Tyrone Slothrop

Any idea of why this will not work? I have an image editor in a popup
that is opened from a form in a window containing data as well as
displaying images for the record. When the image has been saved, it
posts to the form in the opener from the popup, updating the record
with the new image.

Everything is working perfectly but the popup refuses to close.

After the image is saved to the server, this is the HTML which is
generated:

<html><head><title>Image Editor</title>
<body>
<form name="form" action="http://www.domain.com/data.php"
method="post">
<input type="Hidden" name="index" value="<?=$_REQUEST['index']?>" />
<input type="Hidden" name="edit" value="Edit" />
<div style="display:none"><input type="submit"></div>
</form>
<script type="text/javascript">
<!--
function submitform(thisForm)
{
if (!opener.closed)
{
if (opener.name) {thisForm.target=opener.name;}
else {thisForm.target = opener.name
='parentwin'+math.floor(math.random()*10000);}
}
thisForm.submit();
}
document.onload = submitform(document.form);
setTimeout('top.close()', 3000);
//-->
</script>
</body></head></html>

Any ideas?

TIA!
 
A

ASM

Tyrone Slothrop a écrit :
Any idea of why this will not work? I have an image editor in a popup
that is opened from a form in a window containing data as well as
displaying images for the record. When the image has been saved, it
posts to the form in the opener from the popup, updating the record
with the new image.

Everything is working perfectly but the popup refuses to close.

After the image is saved to the server, this is the HTML which is
generated:
(snip)

document.onload = submitform(document.form);
setTimeout('top.close()', 3000);
//-->
</script>

Any ideas?

no idea about the use of this popup

it is not
document.onload
but
window.onload
or simpler :
onload = setTimeout('self.close()',3000);

If that doesn't work better, try :
onload = setTimeout('opener.foo.close()',3000);
where 'foo' is JS name of the popup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top