Can someone please let me know that if I have a web page that consists of a checkbox (parent) and on this same web page, I also have a iframe that is sourced from another page that displays a number of records, which also has a checkbox (children) against each record, if I tick the parent checkbox and assume the iframe is hidden from the user (have a feature to show/hide iframe), can I set all children checkboxs within this hidden iframe or does the iframe need to be rendered?

I am hoping that this can be achieved without rendering the iframe contents.

Thanks, Tony.

2 Answers

DreadPirateShawn On Best Solutions

Yes, this is possible; regardless of the iframe's display state, it is still part of the DOM. (I assume you're hiding it using CSS "visibility:hidden" or -- more likely -- "display:none".)

<script type="text/javascript">
function updateFrameCheck(childName, status)
  var x = document.getElementById("frameThing");
  var y = x.contentDocument.getElementById("formIdFromIframe");
  y.elements[childName].checked = status;

<iframe src="otherpage.htm" id="frameThing"></iframe>

<input type="checkbox" onclick="updateFrameCheck(, this.checked)" name="childName" />

futureelite7 On

It does not matter if the Iframe is shown to the user or not. Even if you set css style as 'display: none' you can still programatically interact with the contents of the iframe.

You can set all the checkboxes and display to the user when ready.