[thelist] JavaScript: lost reference to opener?

Tab Alleman Tab.Alleman at MetroGuide.com
Fri May 7 10:06:49 CDT 2004


I have a page with a link on it that opens a pop-up window that contains
a frameset.  

At first, I designed it so that when a button was clicked in the top
frame, it would print the bottom frame and then close the popup and
return focus to the page that opened the popup.  It worked fine.

Then I realized that I needed to update my database as well, so I made
the top frame submit a form to a second page that would update the
database, and then do the same JavaScript function that prints the
bottom frame and closes the popup.  On the second page, the print still
works, but the frameset no longer returns focus to the opener and closes
itself.  It doesn't throw a JavaScript error either, so I am assuming
this is expected behavior?  

Is there a way to achieve what I want?  I only need it to work in IE6.

Here's my JS function ('View' is the name of the bottom frame in the
frameset):

function PrintCertificate()
	{
	parent['View'].focus();
	parent['View'].print();
	alert('Certificate sent to printer.');
	parent.opener.reload();
	parent.opener.focus();
	parent.close();
	}


More information about the thelist mailing list