title: JavaScript: Change text color with a button, each time the button is clicked a different style should show up. Not working
body: <p><br></p>
  
  <p>I'm fairly new to JavaScript. I just made this simple script:</p>
  
  <p>[HTML code]</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  
  &lt;script src="externalscript.js"&gt;&lt;/script&gt;
  
  &lt;p id="text"&gt;This text will change style&lt;/p&gt;&lt;br&gt;
  &lt;button type="button" onclick="changeStyle()"&gt;Click me&lt;/button&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>[JS code]</p>
  
  <pre><code>function changeStyle() {
  
  status = 1;
  x = document.GetElementById("text");
  
  if(status==1) {
      x.style.color = 'blue';
      status = 2;
  }
  
  if(status==2) {
      x.style.color = 'red';
      status = 3;
  }
  
  if(status==3) {
      x.style.color = 'yellow';
      status = 1;
  }
  
  }
  </code></pre>
  
  <p>I want it to change the text to a different style each time the button is clicked. However, this is not working. Could anyone explain a way to do this correctly?</p>