To test the page code:
Copy Code code as follows:
<title>jquery way to access the IFRAME page DOM elements </title>
<meta name= "Author" content= "Sun Qin wave" >
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>
<script type= "Text/javascript" src= "Http://s1.bdstatic.com/r/www/cache/static/jquery/jquery-1.10.2.min_ F2fb5194.js "></script>
<script type= "Text/javascript" >
function Getiframedom () {
Gets the test element for the IFRAME
var test = $ ("#frame_1"). Contents (). Find ("#test");
Alert (test.html ())
}
</script>
<body>
<iframe src= "file:///C:/Users/SUN/AppData/Local/Temp/non9C34.htm" id= "Frame_1" ></iframe>
<br/>
<a href= "Javascript:getiframedom ();" > Get the IFRAME page test element content </a>
</body>
Test.html page Code
Copy Code code as follows:
<title>iframe page a.html</title>
<meta http-equiv= "Content-type" content= "Text/html;charset=utf-8"/>
<body>
<div id= "Test" > I am the test page test</div>
</body>
Click the test button effect: