Jump to content

Recommended Posts

I've got a checkbox inside an iframe which is inside a Javascript popup using AJAX - 3rd party scripts.

 

How can I set a hidden checkbox on my parent window to reflect the ticked status of the checkbox in the iframe?

 

Many thanks.

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>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.