title: Get the value of an <h2> tag with JavaScript
body: <p>I am trying to generate an MD5 check-sum of every element on a page that has the <code>&lt;h2&gt;</code> tag, then display the values as a popup.</p>
  
  <p>The code I have already should get each <code>&lt;h2&gt;</code> element, I just need to get the actual value of each one.</p>
  
  <pre><code>var ghead = document.getElementsByTagName('h2');
  
  for (i=0; i&lt;ghead.length; i++) {
      var gh = ghead[i];
      var ts = gh.toString();
      var ms = b64_md5(ts);
      alert(ts);
      alert(ms);
  }
  </code></pre>
  
  <p>The usage of <code>b64_md5(ts)</code> basically is what converts the <code>ts</code> variable into the MD5 value. However, the <code>ts</code> variable is the ID or name of the Type of Element, not the Element's value itself.</p>
  
  <p>Also, if I wanted to make a cookie that has two values stored in it, a name and a checksum, could I use <code>gh.innerText;</code> to set the unique name, as I have had issues with using this method so far.</p>