Bonjour à tous,

Je tente de modifier dynamiquement mon image de fond comme ceci :


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
27
<html>
  <head>
    <title></title>
      <script language="JavaScript">
        var imageA="jump1280.png";
        var imageB="family1280.png";
        var i=0;	
        function change()
        { if (++i == 2)
          { i=0;
            document.["image"].style.backgroundImage=imageA;
          } else 
            document.style.backgroundImage=imageB;
          return false;
        }
      </script>
  </head>
  <body> 
    <h2>Essai</h2>
    <br>
    <div id="image">Le Background doit changer ici...</div>
    <br><br>
    <form> 
      <input type="button" value="changer l'image" onClick="change();">      
    </form> 
  </body>
</html>
Mes connaissances étant limitées, je solicite votre aide !

Merci par avance