Purtroppo non c’è un metodo facile per accedere al document allínterno di un Iframe, ma possimamo facilitare questa operazione con un semplice paio di condizioni:


var iFrameContainer = document.getElementById('iFrameContainer');
// l'oggetto document all'interno dell'iFrame
var iFrameContent = null ;

if (iFrameContainer.contentDocument) {
// Firefox
iFrameContent = iFrameContainer.contentDocument;
}
else if (iFrameContainer.contentWindow) {
// IE > 5
iFrameContent = iFrameContainer.contentWindow.document;
}
else if (iFrameContainer.document) {
// IE5
iFrameContent = iFrameContainer.document;
}
else {
// non si puó mai sapere
return false;
}

Trackback

no comment untill now

Add your comment now