View Full Version : simultaneous close window redirect parent

07-15-2003, 08:28 PM

I'm having a hard time combining functions. I wish to have one button which will do both:

close a popup window (basically an 'agree' page) and
redirect the parent window to a desired URL

I've tried several iterations of things, but continue to get poor behavior. The parent redirect works, but the popup does not close. For instance,

<SCRIPT Language="javascript" type="text/javascript">
<!-- close this window and change parent window to new URL

newWindow = null

function updateParent(newURL) {
opener.document.location = newURL;
if (newWindow && !newWindow.closed) {

// end hiding script -->

Within the body of my page, I attempt to

<input type=button value="I Agree" onClick="updateParent('thumbnails.htm?c=cool&y=yes')">

It should be obvious to me, but it isn't. Any help would be wonderful.


Roy Sinclair
07-15-2003, 09:01 PM
<input type=button value="I Agree" onClick="updateParent('thumbnails.htm?c=cool&y=yes');window.close();">

07-15-2003, 09:42 PM
thanks Roy,

That was the trick!