PDA

View Full Version : Problem with closing a popup window


yznf
09-02-2008, 11:00 PM
Hi,

I have a popup window that I can't seem to get closed with a button.

The page is opened from within a page that consists of 3 frames.

The popup window is opened from a frame with frame name "framePage2" within an asp page called NarrFoot.asp.

First, a window.open is used to open the frameset page.

var objwindow = window.open ("narrsummnotepadframeset.asp?associd=" + associd + "&narrativepartnerid=" + partnerid , "MySummary", strfeatures);

Then, the frameset page opens the actual frame, framePage2:

<FRAME NAME="framePage2" SRC="narrsummnotepad.asp?associd=<%=request("associd")%>&narrativepartnerid=<%=narrativepartnerid%>" noresize>


The page narrsummnotepad.asp is the actual popup that I can't seem to get closed. Is there something special I would need to do because of it being opened from a parent page?

I've tried using something like:

<input type='button' Name=btnCancel value='Close this Window'>

function btnCancel_onClick()
{
window.opener = top
window.close()
}
end function

and several other ways, but I can't seem to get the window to close. Could someone give me a hand?

Thanks!

hinch
09-02-2008, 11:12 PM
<input type='button' Name=btnCancel value='Close this Window' onclick="window.close()">

easy as that

yznf
09-02-2008, 11:26 PM
Well I wish that would have worked, but when I try that and press the button it doesn't do anything. That's why I thought it might have something to do with being opened from a previous page.

I'm using IE6, XP Pro. I wonder if the XP has anything to do with it. I read somewhere this would not work too well with XP.

hinch
09-02-2008, 11:28 PM
shouldn't do I open a popup using the same window.open style on one of mysites and close it using the button above just fine.

You could perhaps try this.close but i think thats IE specific and probably quite old if your loading frames within frames it could also be a parent/child problem but unlikely your best bet is to check with the JS people on here as its more a JS problem than an asp problem at a guess.

yznf
09-03-2008, 12:12 AM
shouldn't do I open a popup using the same window.open style on one of mysites and close it using the button above just fine.

You could perhaps try this.close but i think thats IE specific and probably quite old if your loading frames within frames it could also be a parent/child problem but unlikely your best bet is to check with the JS people on here as its more a JS problem than an asp problem at a guess.
Ok Thanks