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 control parent window 2

Status
Not open for further replies.

codeone

Programmer
Joined
Mar 25, 2003
Messages
343
Location
US
Hello,
I was wondering if anyone knew how to manipulate the actions of a parent window from it's child window, either with buttons, text, etc. To do such tasks as to close the parent window, write to it, etc. Thanks ahead of time.

Code One
 
If you use parent.document, you have access to all document elements from a child window. You can access all properties and methods of all objects from there.

T
 
Hey sweet buddy, thanks for the help!


Code One
 
Hey you still get the star . . .hey can you show me how to structure this code? I know it sounds stupid of me asking but Im kind of a newbie to JS . . . heres what I got.

<head>
<title></title>
<script>
function killparent() {
parent.document
window.close()
}
</script>
</head>

<body>

<input type=&quot;button&quot; onclick=&quot;killparent()&quot; value=&quot;kill&quot;>

That does not work, it turns off the child and I want it to turn off the parent, how do I do this? Thanks in advance


Code One
 
function killparent() {
parent.window.close();
}

though the user will be asked whether they want to close the window or not. this should solve that:

function killparent() {
parent.window.opener = self;
parent.window.close();
}

=========================================================
while (!succeed) try();
-jeff
 
That is great thanks jemminger!

thanks for the help fellas,

Code One
 
That is great thanks jemminger!

thanks for the help and have a great day,

Code One
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top