Redimensionnement iframe

cs_laurent98 Messages postés 4 Date d'inscription lundi 5 août 2002 Statut Membre Dernière intervention 16 juillet 2003 - 13 août 2002 à 11:13
sniperwolf83 Messages postés 3 Date d'inscription jeudi 11 mars 2004 Statut Membre Dernière intervention 16 octobre 2007 - 11 mars 2004 à 14:29
je voudrai, apres avoir detecter la resolution ecran,

lancer une iframe de taille precise. Pb je n'arrive pas a y acceder, ja fait :

var res;
res = screen.width;
var w = res - 145;
var h= res - 295;
parent.frames["nomdemoniframe"].resizeTo(w,h);

? avec les frames ca marche

3 réponses

cs_Dean Messages postés 500 Date d'inscription mardi 16 avril 2002 Statut Membre Dernière intervention 2 août 2004
14 août 2002 à 18:23
Considère ton iframe comme un autre élément HTML "classique" et essaie d'y accéder avec le DOM :

moniframe = document.getElementById('idiframe');
moniframe.width = nouvellelargeur;
moniframe.height = nouvellehauteur;

Dean
http://charloweb.free.fr
0
ludo7910 Messages postés 5 Date d'inscription vendredi 7 mars 2003 Statut Membre Dernière intervention 25 août 2005
24 oct. 2003 à 16:34
Une réponse un peu tardive à ce problème mais ca peut aider certains, car j'en ai eu besoin aujourd'hui, allez voir ce lien ils expliquent comment redimensionner automatiquement une iframe suivant son contenu

http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/q278/4/69.asp&NoWebContent=1

ou bien voici directement le code:

<HTML>
<HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
function reSize()
{
try{
var oBody	=	ifrm.document.body;
var oFrame	=	document.all("ifrm");

oFrame.style.height = oBody.scrollHeight + (oBody.offsetHeight - oBody.clientHeight);
oFrame.style.width = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);
}
//An error is raised if the IFrame domain != its container's domain
catch(e)
{
window.status =	'Error: ' + e.number + '; ' + e.description;
}
}
//-->
</SCRIPT>
</HEAD>



</HTML>
0
sniperwolf83 Messages postés 3 Date d'inscription jeudi 11 mars 2004 Statut Membre Dernière intervention 16 octobre 2007
11 mars 2004 à 14:29
Moi jutilise un autre script qui ressemble , mais jai tjrs le meme probleme :
ca fonctionne bien avec l'url complete mais des que je fait une redirection , ca marche plus ...
qqun aurait une solution ?
0
Rejoignez-nous