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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SUBSTITUTE (new) window

Status
Not open for further replies.

aribert888

Programmer
Jan 12, 2003
11
DE
Out of a Flash menu I am opening a html popup by pressing the button 'example1'. No problem.

on(release){
getURL ("javascript:NewWindow=window.open('example1.htm','name','width=835,height=220,left=0,top=0,toolbar=No,location=No,scrollbars=No,status=No,resizable=No,fullscreen=No'); NewWindow.focus(); void(0);");
}

Every time I press a button in the Flash menu a NEW window opens. So in the end 10 windows are open. I rather want that the previous window is closed and a new window is opened. With other words: the previous window should be substituted.

How can I do THAT?

Thanks a lot for thinking and helping!
 
Define NewWindow as a global variable somewhere: NewWindow = '';

Then add the following at the start of your onclick code:
Code:
if(NewWindow.location)NewWindow.close();

That should about do it. Post back here if you get into trouble with it.
 
Note: the definition of NewWindow is two single quotes, not one double quote. It could be: NewWindow = ""; -- hope that makes sense. :)
 
Thank you for your help.

I just found out: If I keep the same name where in my script I had put 'example1' - no new window will open.
But as it does not work really smooth I will try to follow your advice.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top