title: Trying to set a variable as 0 and increase it with every onclick function execution
body: <p>I am new to javascript, but here it is. I am working on this page, and I want it to increase the variable for each question asked. I am confused as to why it is not working properly, I have tried different things for hours.</p>
  
  <p><a href="http://www.sprayfoamsys.com/cmsdev/index.php?page=rig-constructor" rel="nofollow">http://www.sprayfoamsys.com/cmsdev/index.php?page=rig-constructor</a></p>
  
  <pre><code>function clearVar(){
  var sec1=0;
  document.getElementById('sec1text').innerHTML = sec1;
  var sec2=0;
  document.getElementById('sec2text').innerHTML = sec2;
  var sec3=0;
  document.getElementById('sec3text').innerHTML = sec3;
  }
  
  function sec1Var(){
  sec1++;
  document.getElementById('sec1text').innerHTML = sec1;
  alert(sec1);
  }
  
  function sec2Var(){
  sec2++;
  document.getElementById('sec2text').innerHTML = sec2;
  alert(sec2);
  }
  
  function sec3Var(){
  sec3++;
  document.getElementById('sec3text').innerHTML = sec3;
  alert(sec3);
  }
  </code></pre>