title: How do I increment an integer inside a variable, every time that variable is called? Javascript
body: <p>How do I increment an integer inside a variable, every time that variable is called? Javascript.</p>
  
  <pre><code>var a=0;
  
  var t=loadXMLDoc("http://ws.audioscrobbler.com/2.0/?method=artist.getinfo&amp;artist="+x[a].getElementsByTagName("name")[0].childNodes[0].nodeValue+"&amp;api_key=83e386b0ba08735e3dee9b118478e56d&amp;lang=en").getElementsByTagName("bio");
  
  for (i=0;i&lt;20;i++)
  {
  document.write("&lt;div&gt;&lt;button type='button' onclick='document.getElementById("+i+").innerHTML=t[0].getElementsByTagName(\"summary\")[0].childNodes[1].nodeValue;'&gt;Open Bio&lt;/button&gt;&lt;/div&gt;");
  }
  </code></pre>
  
  <p>I'm not sure how I would go about incrementing variable a. I need it to increase by 1 every time variable t is called in the for loop. </p>
  
  <p>When I put all of the code in the for loop I get [object node list] returned so this method is not desired.</p>