title: Changing between 2 images with a button
body: <p>HTML:<br>
      
      </p>
  
  <pre><code>&lt;head&gt;
      &lt;meta charset="UTF-8"/&gt;
      &lt;meta name="keywords" content="HTML, CSS"/&gt;
      &lt;link href= "Task1.1.css" rel="stylesheet"/&gt;  
      &lt;title&gt; Task 1.1 HTML and CSS Demo Page&lt;/title&gt;
      &lt;script src="Task1.2.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;header&gt;
          &lt;h1&gt;Title of Article about Interesting Visualisation&lt;/h1&gt;
      &lt;/header&gt;
      &lt;h2&gt;Author of Interesting Article&lt;/h2&gt;
      &lt;p&gt;The NAPLAN is a test that measures students’ &lt;b&gt;knowledge, skills, and abilities&lt;/b&gt; over an extended amount of time. Instead, It examines students’ general understanding and advancement in literacy and numeracy rather than focusing on a specific subject. Studying NAPLAN &lt;i&gt;past papers&lt;/i&gt; is one of the ways that you can ensure your child’s preparation for the NAPLAN.&lt;/p&gt;
      &lt;ol&gt;
          &lt;li&gt;Knowledge&lt;/li&gt;
          &lt;li&gt;Skills&lt;/li&gt;
          &lt;li&gt;Abilities&lt;/li&gt;
      &lt;/ol&gt;
      &lt;button type="submit" id="btn1" onclick="changeImage('2011')"&gt;2011&lt;/button&gt;
      &lt;button type="submit" id="btn2" onclick="changeImage('2017')"&gt;2017&lt;/button&gt;
      &lt;figure&gt;
          &lt;img id="2011" src="images/NT_Naplan_Reading_Results_2011.png" alt="Naplan Results"/&gt; 
              &lt;figcaption&gt;Fig 1. Percent of children above national minimum standard in reading in 2011 for Year 3, 5, 7 and 9 for Non-Indiginous and Indiginous children in the Nothern Teritory. Data Source: &lt;a href=""&gt;NAPLANresults&lt;/a&gt;&lt;/figcaption&gt;
      &lt;/figure&gt;
  
      &lt;figure&gt;
      &lt;img id="2017" src="images/NT_Naplan_Reading_Results_2017.png" alt="Naplan Results"/&gt;
          &lt;figcaption&gt;Fig 2. Percent of children above national minimum standard in reading in 2017 for Year 3, 5, 7 and 9 for Non-Indiginous and Indiginous children in the Nothern Teritory. Data Source: &lt;a href=""&gt;NAPLANresults&lt;/a&gt;&lt;/figcaption&gt;
      &lt;/figure&gt;
      &lt;p&gt;The overall NAPLAN recipe for success is that the more I practiced for my Naplan testing and experienced success, the more confident I felt. It really helped on the day as I went into the test more relaxed and with a clear head space.&lt;/p&gt;
  
  &lt;footer&gt;
      &lt;p&gt;&lt;b&gt;COS30045 Data Visualiastion&lt;/b&gt;&lt;/p&gt;
      &lt;p&gt;&lt;b&gt;27th February 2018&lt;/b&gt;&lt;/p&gt;
  &lt;/footer&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>JS: </p>
  
  <pre><code>function changeImage(imgid)
  {
      if(imgid=='2011')
      {
          document.getElementById(imgid).src="images/NT_Naplan_Reading_Results_2017.png";
      }
      else if(imgid=='2017')
      {
          document.getElementById(imgid).src="images/NT_Naplan_Reading_Results_2011.png";
      }
  }
  </code></pre>
  
  <p>This is my code so far, everything works but I can't figure out how to get my images to change. At the moment I have 2 images and I can get them to change to the other but I want 1 image that will change to either of the images I choose when clicking the button. How would I go about fixing this?</p>