title: Javascript update/increment variable value on click
body: <p>I have this following code: <a href="http://jsfiddle.net/TSaaJ/1/">JS Fiddle</a></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;script&gt;            
              function increase(){
                  var a = 1;
                  var textBox = document.getElementById("text");
                  textBox.value = a;
                  a++;
              }            
          &lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
          &lt;button type="button" onclick="increase()"&gt;show&lt;/button&gt;
          &lt;input type="text" id="text"&gt;
      &lt;/body&gt;
  &lt;/html&gt;​
  </code></pre>
  
  <p>What I am trying to do is:</p>
  
  <ol>
  <li>On clicking the button the value of 'a' will be displayed in the textbox and 'a' will be incremented.</li>
  <li>On clicking again now the incremented value should be displayed but this doesn't happen.</li>
  </ol>
  
  <p>Where am I going wrong?</p>