Peter: Bild wechseln

Beitrag lesen

Moin!

Ich möchte ein Bild alle 1,5 sekunden mit javascript wechseln. Mit meinem Code wird es allerdings nur EIN mal gewechselt. Wisst ihr warum?

Hier der Code:

<html>
<head>
  <title>JS-Test</title>
</head>
<body>
  <img src="icon1.jpg">
  <script type="text/javascript">
    <!--
      function change()
      {
        if (document.images[0].src = "icon1.jpg")
        {
          document.images[0].src = "icon2.jpg"
        }
        else
        {
          document.images[0].src = "icon1.jpg"
        }
      }
      setInterval("change()", 1000);
    //->
  </script>
</body>
</html>

danke schon mal für eure Hilfe
Peter