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

Please help

Status
Not open for further replies.

pbellc

Programmer
Jun 6, 2003
36
US
I know this is possible to do, and I am certain that it is also very easy. I'm really new at this and need some help.

What I want to do is to close a parent window (an hta file with a DHTML menu) on the open of the child window. Will this event make the child window now the parent window? Do I put the code inside the DHTML menu code, or in the hta code of the pages? I only want the parent window to close when a click event happens within the confines of the menu -- not when a user clicks somewhere within the hta document.

I hope this is a clear quesiton. I really appreciate any help someone can give.
 
Easiest way to do this is on the child page...

<script>
function closeParent()
if (window.opener){
window.opener.close()
self.focus()
}
}
</script>

<body onLoad=&quot;closeParent()&quot;>

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
I tried that, it didn't work. Where in the code of the child page should I put it?
 
Sorry to keep posting to my own thread, but...

Do I need to specify in that when a new window opens that it is the child?
 
The code goes into the HTML of the child window.
You do not need to specify it as a child window - that happens implicitly when you open it.

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top