js / jquery / html:从iframe获取div

时间:2009-05-07 18:34:58

标签: javascript jquery html

如何将iframe中的div转换为JS变量?不一定要使用jQuery。

2 个答案:

答案 0 :(得分:9)

document.getElementById('IframeId').contentWindow.document.getElementById('DivId');

答案 1 :(得分:9)

在jQuery语法中,这将是$('iframe').contents().find('div')。 (当然,替换你需要的任何特定的id /类/其他选择器)。 Tracker1的答案应该适用于标准Javascript。

相关问题