Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello there! I have used the win

Status
Not open for further replies.

Tezdread

Technical User
Oct 23, 2000
468
GB
Hello there!

I have used the window.open function and it work fine, but what I would like to happen is when I click on another link, it first closes the open window before opening the new one?

Here is part of the script I am using at the moment, and hope that I can just add a new line into it?

<!--
function my_win()
{
window.open('design.htm','mywindow','width=250,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
}
function my_win2()
{
window.open('domain.htm','mywindow','width=250,height=300,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
}
//-->

Then the links are:
<a href=&quot;javascript:my_win()&quot;>link</a>
<a href=&quot;javascript:my_win2()&quot;Link2</a>

And the link in the open window is:
<a href='javascript: window.close();'>Close Window</a>

I was hoping that I could just add window.close() to the open window link but unfortunatly not.

Thanks in advance if any one can help
 
you can have the parent window close after you open the other window, but it will probably display a message that says that the window is trying to close itself and propmt you if you want to let it.

just add window.close() at the end of your function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top