收集利用Jquery取得iframe中元素的几种方法 :
- $(document.getElementById('iframeId').contentWindow.document.body).htm()
$(document.getElementById('iframeId').contentWindow.document.body).htm()
显示iframe中body元素的内容。
- $("#testId", document.frames("iframename").document).html();
$("#testId", document.frames("iframename").document).html();
根据iframename取得其中ID为"testId"元素
- $(window.frames["iframeName"].document).find("#testId").html()
$(window.frames["iframeName"].document).find("#testId").html()
作用同上
收集网上的一些示例:
用jQuery在IFRAME里取得父窗口的某个元素的值
IE7中测试通过