Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IFRAME

Status
Not open for further replies.

3DDD

Programmer
Oct 15, 2003
30
US
Is there any way to get the total number of elements in iframe?

For eg: Suppose I have 30 checkboxes in IFrame. Now I want to loop through and set them as checked.

thanks
 
Your function can go something like...
Code:
<script type=&quot;text/javscript&quot; language=&quot;javascript&quot;>
function setAllChecks(formObj, how){
  for (var i = 0; i < formObj.elements.length ; i++){
    var el = formObj.elements[i]
    if (el.type.toLowerCase() == 'checkbox') {
      el.checked = how
    }
  }
}
</script>

When you call setAllChecks() and pass it a form object and a true/false value, it should switch all the checkboxes to the correct value.

...the code above may contain syntactical errors... please regard this as a hint, not a solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top