" iframe.contentDocument"不工作在IE8和FF(3.5及以下)任何其他步骤来解决这个问题? [英] " iframe.contentDocument" Not Working in IE8 and FF(3.5 and below) any other steps to solve this?
本文介绍了" iframe.contentDocument"不工作在IE8和FF(3.5及以下)任何其他步骤来解决这个问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在js file-uploader中使用了这个iframe.contentDocument,但它不能在IE8,Firefox(3.5及以下版本)中运行。
如何通过使用其他DOM来处理iframe来解决这个问题? / p>
感谢所有
解决方案
试试
var doc;
var iframeObject = document.getElementById('iframeID'); //必须有一个ID
if(iframeObject。 contentDocument){// DOM
doc = iframeObject.contentDocument;
}
else if(iframeObject.contentWindow){// IE win
doc = iframeObject.contentWindow.document;
}
if(doc){
var something = doc.getElementById('someId');
}
else {
alert('想知道什么是浏览器这是......'+ navigator.userAgent);
}
I used this "iframe.contentDocument" in js file-uploader , But it not working in IE8 ,Firefox(3.5 and below versions. How can i solve this by using other DOM's for working with iframe ?
Thanks to all
解决方案
Try
var doc;
var iframeObject = document.getElementById('iframeID'); // MUST have an ID
if (iframeObject.contentDocument) { // DOM
doc = iframeObject.contentDocument;
}
else if (iframeObject.contentWindow) { // IE win
doc = iframeObject.contentWindow.document;
}
if (doc) {
var something = doc.getElementById('someId');
}
else {
alert('Wonder what browser this is...'+navigator.userAgent);
}
这篇关于" iframe.contentDocument"不工作在IE8和FF(3.5及以下)任何其他步骤来解决这个问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文