Yesideez Posted January 23, 2009 Share Posted January 23, 2009 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. Quote Link to comment Share on other sites More sharing options...
valtido Posted January 23, 2009 Share Posted January 23, 2009 im not sure i understood u right but. from the iframe you can use the top.document.getElementbyId('checkboxid').checked= 'checked' that will check it also try true and false but unquoted. Quote Link to comment Share on other sites More sharing options...
Psycho Posted January 23, 2009 Share Posted January 23, 2009 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> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.