11548 sujets

JavaScript, DOM et API Web HTML5

Suite de ...
http://forum.alsacreations.com/topic-5-19099-1-resolu-Probleme-fonction-scrollTo-dans-un-DIV.html

Bonjour à tous !

J'ai le meme problème qu'en 2006 ... mais cette fois c'est une iframe ! Smiley cligne

J'ai cherché et je ne trouve pas la solution ... ;-(

j'ai trouvé pour FF, mais ca marche pas sous IE



<IFRAME id="nom_de_iframe" width="100%" height="100%" marginheight="0" marginwidth="0" 
frameborder="0" scrolling="auto" SRC="?page=chat">
</IFRAME>


Et je désire une function qui descende l'ascenseur jusqu'au bas du contenu de l'iframe !

Ca marchait bien avec un DIV (Cf le lien) mais plus avec IFRAME !

Une idée ?

Merci !!


Le code sous IE qui devrait marcher ...



	window.document.getElementById("nom_de_iframe").scrollTop = window.document.getElementById("nom_de_iframe").scrollHeight;



Le code sous FF qui marche, mais qui marche pas sous IE !!! :

window.document.getElementById("nom_de_iframe").contentDocument.body.scrollTop = window.document.getElementById("nom_de_iframe").contentDocument.body.scrollHeight;

Modifié par Dexterin (11 Jan 2008 - 21:30)
J'ai trouvé !

var ie4=document.all
	var ns6=document.getElementById&&!document.all

	if (ie4) {

	 var mon_iframe = window.frames["chat_iframe_chat"]; 
	 mon_iframe.document.body.scrollTop = mon_iframe.document.body.scrollHeight
	
	}
	else if (ns6) {
		window.document.getElementById("chat_iframe_chat").contentDocument.body.scrollTop = window.document.getElementById("chat_iframe_chat").contentDocument.body.scrollHeight;
	}