PDA

View Full Version : Close window (Link)


Paul Bristow
03-09-2002, 02:13 PM
I am trying to close a popup window, but something a bit different, because I require the CLOSE function to also include a link to a targeted web page inside an existing frameset, my attempts at this has not been very succesfull the code I have been using is as follows:

<A HREF="Javascript:window.close()">
<FONT FACE="Arial" SIZE="3"><A HREF="main2.htm" TARGET="main">Here is your Link</A></FONT></A>

The link works fine but the window will not close can anybody help

Thank you
Paul

scoutt
03-09-2002, 02:55 PM
2 href tags in together? never seen that before.

try this.

<FONT FACE="Arial" SIZE="3"><A HREF="main2.htm" TARGET="main" onClick="window.close()">Here is your Link</A></FONT></A>

Paul Bristow
03-09-2002, 04:18 PM
Thanks for the reply,the window closes but the link does not work a reverse of what I had i.e The link worked but the window would not close.

Any other ideas?

Dr. Web
03-10-2002, 12:52 AM
a lot of times the browser just does whatever is faster. Unfortunately, its a lot faster to close the window than to do anything else. Call the browser lazy... so what we need to do is ask it to wait a few seconds before closing. That gives it a sec to target the main frame with the new page.

Just change the '3000' to a shorter time if you want.


<a href="main2.htm" target=main onClick="TimerNew = setTimeout('self.close();', 3000);">link, then close</a>

Paul Bristow
03-10-2002, 07:17 AM
Thank you for the support, and your knowledge, the code works to perfection.

Thanks again

Paul