Click to See Complete Forum and Search --> : Child - parent control


Code One
04-18-2003, 12:49 AM
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

DrDaMour
04-18-2003, 02:04 AM
isn't it document.parent or is just parent, either way parent is a keyword to get you to the reference of that object, from there you can do anything

Code One
04-18-2003, 03:14 AM
sorry kinda new to JS . . .

Function poop() {
document.parent.window.close()
}

<button onclick="poop()">poop</button>

thanks

CO

DrDaMour
04-18-2003, 04:06 AM
window.parent is the parent window. I just foudn this out too.

Code One
04-18-2003, 10:41 PM
Whats up? How you been? I bet you are looking great and feeling fine . . . I hope. ;) anyway I am such a lamer and I need help on the easiest code ever, I want to be able to turn off a parent window with a button located in the child in which the parent had spawned
got it? Well heres what I got, dont laugh . . . ,

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

<body>

<input type="button" onclick="killparent()" value="kill">

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

DrDaMour
04-19-2003, 01:23 AM
parent.close()

khalidali63
04-19-2003, 01:44 AM
Check this link out...

http://68.145.35.86/skills/javascripts/CloseParentWindowFromChild.html

Hope this helps

DrDaMour
04-19-2003, 01:51 AM
oh...he wanted opener not parent, should have known

Code One
04-19-2003, 03:06 AM
Awesome code

Thanks again


Code One

btw. thought parent and opener was technically the same thing? ;)

Code One
04-19-2003, 03:38 AM
but I have to ask you something, but it may make me look un greatful or slefish or something, so dont get mad. I was wondering if someone could show me how o set up the same code except have it paste the contents of your clipboard with in a textarea located in the opener of the child window, with a button located in the child window, also as follows:

==========================================

1. opener window

a. loads
b. click pop up button
c. window pops up

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

2. Pop up window

a. loads
b. click paste button
c. contents of clipboard are pasted in the
textarea located inside the opener window.

==========================================

Sorry to keep asking.

Code One

DrDaMour
04-19-2003, 10:16 AM
first you can set teh HTML of a div using

<div id="kill">

document.all.kill.innerHTML="html here"


second you go throught the child parent relationship to get thsi variable


starting from the popup

window.opener.document.all.kill.innertHTML=""