在iframe子页面获取父页面元素
代码如下:
1 //在iframe子页面获取父页面元素 2 $.('#objld', parent.document); 3 4 //在父页面获取iframe子页面的元素 5 6 $("#objid", document.iframes('iframe').document) 7 //或 8 $(document.getElementById('iframeId').contentWindow.document.body).html() $(document.getElementById('iframeId').contentWindow.document.body).html() 9 10 // 在iframe中调用父页面中定义的方法和变量 11 parent.method12 parent.value
新闻热点
疑难解答