query取得iframe中元素的幾種方法
在iframe子頁面獲取父頁面元素
代碼如下:
$('#objId', parent.document);
// 搞定...
在父頁面 獲取iframe子頁面的元素
代碼如下:
$("#objid",document.frames('iframename').document)
$(document.getElementById('iframeId').contentWindow.document.body).html()
顯示iframe中body元素的內容。
$("#testId", document.frames("iframename").document).html();
根據iframename取得其中ID為"testId"元素
$(window.frames["iframeName"].document).find("#testId").html()