title: How do I get this traffic Light sequence to work with the click of the button???
body: <p>So, I can get it to go from red to amber, but I am stuck on how to further get it to change to green, back to amber and then red again. Any help would be highly appreciated. </p>
  
  <p>Also, I have created this on dreamwaver.</p>
  
  <pre><code>&lt;!DOCTYPE html&gt; 
  &lt;html&gt; 
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;  
  
     &lt;h1&gt;Traffic Lights &lt;/h1&gt;  
  
    &lt;img id="light" img src="../../red.jpg"&gt; 
  
    &lt;button type="button" onClick="changeLights()"&gt;Change Lights&lt;/button&gt;
  
  
     &lt;script&gt;
  
      function changeLights(){
  
     document.getElementById('light').setAttribute("src","../../amber.jpg")
  
     document.getElementById('light').setAttribute("src","../../green.jpg")
  
     document.getElementById('light').setAttribute("src","../../amber.jpg")
  
     //document.getElementById('light').setAttribute("src","../../red.jpg")
  
  
     }
  
    &lt;/script&gt;  
  &lt;/body&gt; 
  &lt;/html&gt;   
  </code></pre>