PDA

View Full Version : Close popup window from DHTML Window Widget



awysocki
12-27-2008, 01:08 AM
1) Script Title: DHTML Window widget

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem: I am using the script, with the contenttype of IFRAME. Is there any way from the iframe page to close the window and refresh the parent. I'm popping up a window to add a comment, I would like to close the popup window and refresh the main page to show the new comment that was added.

Thanks
andy

awysocki
12-27-2008, 01:22 AM
I found it digging into somebody else's post about a different question.

I've added
<SCRIPT language="javascript">
function close_me()
{
var mainP = parent.document.getElementById('commentbox');
mainP.close();
}

</script>

Then on my iframe code I add the following link
<a href="#" onClick="close_me();">Close Window</A>


The key here is when I opened my popup window I used

commentwin=dhtmlwindow.open('commentbox', 'iframe',....

Its the first PARM I needed to search on for the javascript to send the command to close it.