<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>P'tite galerie</title>
<script type="text/javascript">
//Déclarons la fonction qu'on utilisera... je l'appel openImage()...
function openImage(cible){
// cible est un argument, il sera remplacer par ce qu'on aura mis dans les parenthèses quand on appelera la fonction...
var urlImage = cible; // on créé une variable contenant l'url de l'image
var imgCont = document.getElementById("imgCont" );// Celle correspondant à la div qui contiendra la grde image
imgCont.innerHTML = "<img src='"+urlImage+"' width='400' height='300' alt='' />"; // Change le contenue HTML de notre div...
}
</script>
<style type="text/css">
#imgCont { float:left; width:400px; height:300px; border:1px solid black; }
</style>
</head>
<body>
<div id="imgCont"></div>
<a href="#" onclick="openImage('monimage1.jpg')">image 1</a><br />
<a href="#" onclick="openImage('monimage2.jpg')">image 2</a><br />
<a href="#" onclick="openImage('monimage3.jpg')">image 3</a><br />
<a href="#" onclick="openImage('monimage4.jpg')">image 4</a><br />
</body>
</html>