Jump to content

Closing child window and opening a new window


realjumper

Recommended Posts

Hi,

 

My popup window gets closed onClick of the link as in the code below. It also refreshes the parent window to a new location. This works fine but what I would now like to do is to leave the parent window as it is, but open a new window instead of refreshing the parent window to a new location....the parent window can just stay where it is. So, the child window would close onClick, a new window would be opened, and the parent window can just stay where it is.

 

I can't seem to get this right so if anyone can help I would be grateful. Thanks.

 

 

Here's my code......with a bit of php

 


<script type="text/javascript">
function closeMe(){
  if (opener && !opener.closed) opener.location.href = "apply.php?id=<?php echo "$row->id"; ?>";
  window.close();
}
</script>


<?php

echo "<br><b><div class=eventfont><b>Attend This Event:</b> <a href=\"#\" onclick=\"setTimeout('closeMe()', 1)\">Apply Here</a></div>\n";

?>

 

Change this line

if (opener && !opener.closed) opener.location.href = "apply.php?id=<?php echo "$row->id"; ?>";

to

if (opener && !opener.closed) window.open("apply.php?id=<?php echo "$row->id"; ?>", '', 'width:##, height:##');

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.