所以我有
$('.theiframe').load(function(){
var content = $(this.contentDocument).find('pre').html();
}
在 FF、Chrome、IE 8,9 中,iframe 的内容被正确地插入到变量内容中……但是当我使用 IE7 时,内容将变为“空”。
加载 iframe 后,应该如何正确获取 iframe 内容并将其存储到变量中?
最佳答案
为 iframe 命名并以此方式访问它。
$(window.frames[ "iframename" ].document).find("pre").html();
关于javascript - 在 IE 7 中获取 iframe 内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9086105/