This time I will bring you how to use Jquery to get the Dom element in the iframe page, and use Jquery to get the Dom element in the iframe page. What are the precautions? The following is a practical case, one Get up and take a look.
Test page code:<html> <head> <title>jquery方式,访问iframe页面dom元素</title> <meta name="Author" content="孙勤波"> <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(){ // 获取iframe的test元素 var test = $("#frame_1").contents().find("#test"); alert(test.html()) } </script> </head> <body> <iframe src="file:///C:/Users/SUN/AppData/Local/Temp/non9C34.htm" id="frame_1"></iframe> <br /> <a href="javascript:getIframeDom();">获取iframe 页面test元素内容</a> </body> </html>
<html> <head> <title>iframe页面a.html</title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> </head> <body> <p id="test">我是测试页面test</p> </body> </html>
A collection of jquery methods for traversing and filtering arrays and json objects
##Detailed explanation of the steps for jquery to remove selected values from an arrayThe above is the detailed content of Use Jquery to get Dom elements in iframe pages. For more information, please follow other related articles on the PHP Chinese website!