Jump to content

Set hidden checkbox on parent from child window


Yesideez

Recommended Posts

Yes, the value should be the logical true or false values (no quotes). Also, "getElementById()" is not written correctly - the "B" should be capitalized.

 

But, since you are dealing with a popup, just using top.document won't work. This is what I understand:

 

There is a parent window

There is a child window that was opened from the parent.

That child window has frames

In one frame of the child window there is a checkbox that you want to affect a checkbox in the parent window

 

This is interesting. You need to traverse up to the "top" of the popup window and then over to the "parent"

 

I tested this and it works (where 'pc' is the id of the "parent checkbox"):

<input type="checkbox" onclick="top.opener.document.getElementById('pc').checked=this.checked;">

 

Here are my test files for reference:

 

(parent.htm)

<html>
<body>
  <a href="child.htm" target="_blank">Open Child</a><br><br>
  <input type="checkbox" name="pc" id="pc" value="x"> Checkbox
</body>
</html>

 

(child.htm)

<HTML>
<FRAMESET ROWS="10%,*">
     <FRAME SRC="frame.htm">
     <FRAME SRC="http://www.yahoo.com">
</FRAMESET>
</HTML>

 

(frame.htm)

<html>
<body>
<input type="checkbox" value="1" onclick="top.opener.document.getElementById('pc').checked=this.checked;"> One<br>
</body>
</html>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.