javascript - How to Access iFrame Checkbox Elements -


Can anyone tell me if I have a web page that has the checkbox (parent) and this web On the page, I also have an IFrame that comes from another page which displays many records, in which each record also has a checkbox (children), if I stick to the parent checkbox, then I have all children Iframe want to cascade in check box You can also disable these children's checkboxes as well as within.

In fact, may appreciate some help with this because I'm not sure how to use the check box within the iframe.

My iframe definition man page is similar to:

  & lt; Iframe id = "iframe1" src = "'+ url +' style =" border: none; Width: 79 9px; Height: 200px; "Frameborder =" 1 "fraszing =" 0 "margin width =" 0 "margin width =" 0 ">   

Any example / website

Thanks Tony.

OK, here's an example. First of all, here is the source for iframe content (I called it frame page html) ...

  & lt; body & gt; & lt; input id = "Checkbox 1" type = "checkbox" name = "checkbox" /> Input ID = "checkbox2" R = "checkbox" name = "checkbox" /> input id = "checkbox 3" type = "checkbox" name = "checkbox" />   

Here is the source on the page that holds the iframe ...

  iframe id = "frame" src = "frame page. HTTM "& gt; & lt; / iframe & gt; & lt; input id =" button1 "type =" button "value =" button "onclick =" setData () "/> & gt; & gt; script type = "Text / JavaScript" & gt; Function SetData () {var frame = document.getElementById ('frame'); var checkbox = frame.contentWindow.document.getElementsByName ('checkbox'); for (var i = 0; i & Lt; checkbox length; i ++) {checkbox [i]. Checkeded = true;}}   

clicking the button on the parent page All checkboxes will be selected on the frame page with the name 'checkbox'.

Hopefully this :)


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -