Bonjour,

J'ai trouvé un script qui me permet de redimensionner une iframe automatiquement dans ma page web. Jusque là tout marchait bien et je me suis rendu compte qu'en fonction du contenu de certaines pages la iframe ne se redimensionnait pas comme il faut (IE7) ou plus (IE6)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
	<div id="aideMvt">	
		<iframe id="objectAideMvt" src="http://intra62.in.ac-lille.fr/spark/aidemvt/etablissement.php" 
			scrolling="no" 
			marginwidth="0"
			marginheight="0" 
			frameborder="0" 
			vspace="0" 
			hspace="0" 
			style="overflow:visible; width:100%;" 
			onload="setTimeout('resize()',5000);">
		</iframe>
	</div>
 
<script type="text/javascript">
	var iframe = document.getElementById("objectAideMvt");
	var Window = iframe.window?iframe.window:iframe.contentWindow;	/* Switch --> si IE iframe.window // si FF iframe.contentWindow	*/
 
	function resize() {
		try {
			iframe.style.height = Window.document.body.offsetHeight+"px";	// IE6, FF, SAFARI
		} catch (e) {
			iframe.style.height = iframe.document.body.offsetHeight+"px";	// OPERA et autres
		}
	}
</script>
Je me suis dit que çà vient surement du fait que ma page n'était pas fini d'être chargée, j'ai donc mis un setTimeout mais çà ne change rien.