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

Child Windows

Status
Not open for further replies.

siuk

Programmer
Aug 23, 2001
38
GB
Hi,

Does anyone know the correct code for closing a child window? I want to be able to close the child window on the unload event of its parent window. But i cant seem to get it working. Here is some code:
----------------------------------------
Parent Window
----------------------------------------
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function loadit()
{
var url = 'banner.htm';
var x = window.open(url,'statuswin1','height=50,width=160,scrollbars=no,toolbar=0,titlebar=0');
}

function flush()
{
newwin.document.thefunction();
}
</SCRIPT>
</head>
<body onunload=&quot;flush();&quot;>
-------------------------------------------------
Child Window:
-------------------------------------------------
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>

function thefunction()
{
self.close();
}
</SCRIPT>
-------------------------------------------------

Thanks for any help! :)
 
1. you open a window, named x & trying to close a window, named newwin (as far as i see) it have to be working this way..

2. try just to close your child window from its parent (like

<script>
onunload=function(){x.close();}
</script>

) Victor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top