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

Closing Popups 2

Status
Not open for further replies.

Stewart531

Programmer
Feb 18, 2003
36
US
Hi, I'm having a problem closing popup windows created by my program. Right now, I'm trying to call a function I wrote in a javascript file from an ASP file. When I call the function in the js file, it doesn't seem to be aware of the popup that was created earlier by that same js file.

Code:

var NFW = null

function a()
{
NFW = window.open()
}

function b()
{
NFW.window.close()
}

Anybody know what I'm doing wrong or have an alternate solution?

Thanks,
Dave
 
If you refresh or change the location of the parent window, I think it forgets what children it opened. You can use the "target" argument of the window.open method to regain the link.

Open your window like this...
NFW = window.open('somePage.html','myTarget')

Regain the link if you lose it like this...
NFW = window.open('','myTarget')

And close the window this...
NFW.close() Adam
 
Great solution. I am imprested.

Regards,
Sergey Smirnov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top