Bsr Thomas,
Voici un ex de code :
La page qui contient les images en miniatures
vignette.htm
<html><head><title>Test photo</title>
<script language="JavaScript">
<!--
var photographie=0;
var wind=null;
function Photo(fichier, titre)
{
this.fichier = fichier;
this.titre = titre;
}
var photos=new Array();
photos[0]=new Photo('images/test.jpg','Mon image nr 1');
photos[1]=new Photo('images/toto.jpg','Mon image favorite');
// ajoute ici tes autres images ...
function charger_image(idx)
{
photographie=photos[idx];
wind=open("popup.htm",'popup','width=400,height=300,toolbar=no,scrollbars=no,resizable=yes');
return false;
}
// -->
</script>
</head>
<body>
<a href="javascript:void(0)" onclick="return charger_image(0);"><img src="images/test_small.jpg"></a><br>
<a href="javascript:void(0)" onclick="return charger_image(1);"><img src="images/toto_small.jpg"></a><br>
</body>
</html>
La même page qui affiche chaque image en grand :
popup.htm
<html><head><title></title>
<style>
.abs {position:absolute; left:0px; top:0px;}
</style>
<script language="JavaScript">
<!--
// Donne le titre de l'image à la fenêtre
document.title=window.opener.photographie.titre;
// Précharge l'image en mémoire mais ne l'affiche pas
im1=new Image()
im1.src=window.opener.photographie.fichier;
var obj=null;
// Affiche l'image précharger
function afficher()
{
if (document.layers)
{
obj=document.layers["div_photo"].document.images["photo"];
}
else
{
obj=document.images["photo"];
}
obj.src=im1.src;
}
// Redimensionne la fenêtre
function redimensionner()
{
window.resizeTo(obj.width,obj.height);
self.focus();
}
// -->
</script>
</head>
<body onload="redimensionner()">
<div class="abs" name="div_photo">
<img src="images/vide.gif" id="photo" name="photo">
</div>
<script>
<!--
afficher();
// -->
</script>
</body>
</html>
Par défaut lorsque la page popup s'ouvre elle précharge l'image dans l'objet
Im1 de type Image puis affiche l'image transparente : vide.gif
Ensuite l'image est aussitôt remplacée par celle préchargée au départ.
Enfin la fenêtre est redimensionnée.
Et voilà
PhP [Push the button,Don't push the
. button,Trip the station,Change the channel]