“Iframe.contentDocument” que no trabaja en IE8 y FF (3,5 y por debajo) cualesquiera otras medidas para resolver esto?

StackOverflow https://stackoverflow.com/questions/4310946

Pregunta

He utilizado este "iframe.contentDocument" en el archivo de JS-Registro, pero no trabaja en IE8, Firefox (3.5 y versiones a continuación. ¿Cómo puedo solucionar esto mediante el uso de otra DOM para trabajar con iframe?

Gracias a todos

¿Fue útil?

Solución

Trate

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);
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top