...

View Full Version : simultaneous close window redirect parent



newbiedude
07-15-2003, 08:28 PM
hello,

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) {
newWindow.close()
}
}

// end hiding script -->
</script>



Within the body of my page, I attempt to

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

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

confounded.

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

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

That was the trick!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum