“ iframe.contentDocument” Not Working in IE8 and FF(3.5 and below) any other steps to solve this?

后端 未结 1 1788
旧时难觅i
旧时难觅i 2020-12-19 03:06

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 workin

相关标签:
1条回答
  • 2020-12-19 03:18

    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);
    }
    
    0 讨论(0)
提交回复
热议问题