title: How to store HTML headings in JavaScript array
body: <p>I have an javascript array that is hard coded into my javascript file:</p>
  
  <pre><code>var avatar_layers = new Array('background', 'body', 'hair', 'shirt', 'arms', 'legs', 'feet', 'weapon')
  </code></pre>
  
  <p>As it is hardcoded, it is difficult to use it between different HTML files.</p>
  
  <p>I would like to change it so the javascript will look for all the h3 tags that have a class of title on the page and use the content of these tags to create the array.</p>
  
  <p>How can I do this?</p>
  
  <p>After reading around, I have found that I should use the following</p>
  
  <blockquote>
    <p>document.getElementsByTagName("h3.title")[0];</p>
  </blockquote>
  
  <p>This will get all the h3.titles. However, I am not sure how to output the collected data as array.</p>
  
  <p>I would really appreciate any pointers. Thanks!</p>
  
  <p><strong>Update: I can't use Jquery, it has to be regular java script</strong></p>
  
  <p><strong>You can see my code here: <a href="http://jsfiddle.net/zk5Hn/2/" rel="nofollow">http://jsfiddle.net/zk5Hn/2/</a></strong></p>