PDA

View Full Version : How to close a window when in a frame?


Richard2003
02-18-2004, 09:01 PM
I have a main page that has a link to a sub-page that is divided into several frames.

In one of these frames I have put an image that looks like the Windows "X" in the above right corner to close an application.

When I click on this "X" image, I should return back to the main page (without re-running it), but the following code doesn't work. What am I missing?

<a href="javascript:window.close()"><img border="0" align="right" src="x.jpg" width="21" height="21"></a>


Thanks!
Richard

Richard2003
02-18-2004, 09:33 PM
I found myself the answer to close my page containing frames.

Change :
"javascript: window.close()"

to :
"javascript: parent.close()"

and it works! :thumbsup: