View Full Version : I've got this far .. can you help me out please ?

09-05-2006, 11:13 AM
I am working on this for my website - but am stuck!
- please help if you can.

On hitting a link a new window opens.
I then run a script in it and then have a form.

The form is supposed to close that child window and bring me back to the parent / opener window and run a script in it.

I put this in the parent / opener window:

<script type="text/javascript">
window.name = "oldwin";
// -->

and then this is the link that opens the child window:

<a href='$Ad_detail' target='_blank' onclick=\"window.open (this.href, '$Ad_detail', 'height=800,width=960,scrollbars'); return false\" ><b> $Dtype </b></a>
In the child window:
a script runs and shows a form.
my form (in child window) now says this:

<div style='width:400px;position:absolute;left:600px; top:600px;' >
<form name="suspended" action ="a_run_top.php" method = 'POST' target="oldwin" onsubmit="this.close() window.oldwin.focus();">
<input type="hidden" name="del_ctl" value= "Y" >
<input type="hidden" name="section" value= "<?php echo "$section"; ?>" >
<input type="hidden" name="x_yct" value= "<?php echo "$N_yct"; ?>" >
<input type="hidden" name="x_yct_op" value= "<?php echo "$N_yct_op"; ?>"

<input type="submit" class="btn2" value = "Continue"
onMouseout="this.style.backgroundColor='#ccffff'" >

But the result is that the script (a_run_top.php) runs in the child window - not in the parent window as I wanted. :confused:

I am trying to get the child window closed and the script to run in the parent / opener window.

Any more ideas / corrections ? :)

Thanks for help.

09-05-2006, 05:14 PM
Hmm what you might have to is have the form on the opener page and pass the values created by a_run_top.php back to the opener form.

opener.document.forms['suspended'].submit();window.close();return false;
inside of your onsubmit rather than what you have there now.

09-06-2006, 06:56 AM
Thanks -
yer - I was trying for an easier approach but passing from form to form seems the only way - cheers.
(done it)