title: Change button image onclick
body: <p>I have this code to change from image 1 to image 2. How can I make it change from image 2 to image 3, and back to image 1? Thanks</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;button onclick="myFunction()"&gt;&lt;img id="myImg" src="image1.gif" width="107"     height="98"&gt;&lt;/button&gt;
  
  &lt;script&gt;
  function myFunction()
  {
  document.getElementById("myImg").src="image2.gif";
  }
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>