<1> js or jquery to access the frame iframe in the page.
Note: Pages within a frame are not cross-domain! Suppose there are two pages under the same domain.
Assumption: Parent window index.html, iframe with ID subifrm
1. In index.html execute JS direct access to an element in the child window:
document.getElementById (' subifrm '). ContentWindow.document.getElementById (' Test '). style.color= ' Red '
2. Use jquery to access child windows
$ ("#subifrm"). Contents (). Find ("#test"). CSS (' Color ', ' red ');
====================================================================
====================================================================
<2> Interactive operation in a way that combines the DOM approach with the jquery approach
1. Manipulate all the radio buttons in the selected IFrame in the parent window
$ (window.frames["iframe1"].document). Find ("input[@type = ' Radio ']"). attr ("Checked", "true");
2. Action in the IFRAME Select all the radio buttons in the parent window
$ (window.parent.document). Find ("input[@type = ' Radio ']"). attr ("Checked", "true");
====================================================================
====================================================================
<3> using jquery to manipulate IFRAME
1 of two ifame in the page
<iframe id= "Leftiframe" ></iframe>
<iframe id= "mainiframe></iframe>
<iframe id= "Leftiframe" ></iframe>
<iframe id= "mainiframe></iframe>
Leftiframe in jquery changes the SRC code of Mainiframe:
1
$ ("#mainframe", Parent.document.body). attr ("src", "")
2, if the content has an ID of mainiframe ifame
<iframe id= "Mainifame" ></ifame>
<iframe id= "Mainifame" ></ifame>
Ifame contains a Someid
<div id=" SomeID " >you want to get this &NBSP; content </div>
<div id= "Someid" >you want to get this content</div>
Get Someid's content
$ ("#mainiframe"). Contents (). Find ("Someid"). html (); or $ ("#mainiframe"). Contains (). Find ("Someid"). Text ();
$ ("#mainiframe"). Contents (). Find ("Someid"). html (); or $ ("#mainiframe"). Contains (). Find ("Someid"). Text ();
$ ("#mainiframe"). Contents (). Find ("Someid"). html (); or $ ("#mainiframe"). Contains (). Find ("Someid"). Text ();
2, as shown above
Leftiframe in jquery operations Mainiframe content Someid content
$ ("#mainframe", Parent.document.body). Contents (). Find ("Someid"). html (); or $ ("#mainframe", Parent.document.body). Contents (). Find ("Someid"). Val ();
Source