title: Javascript onclick insert value into array
body: <p>I have an image map, with several areas defined. What I'm trying to do is get a value added to an array each time someone clicks on a specific area, and have the array displayed in real-time on the screen.</p>
  
  <p>In my head section I have the array (not sure if this is correct):</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      var numArray = [];
  &lt;/script&gt;
  </code></pre>
  
  <p>Then I have somewhere in the body of the page</p>
  
  <pre><code>&lt;p class="txt"&gt;&lt;script type="text/javascript"&gt;document.write(numArray);&lt;/script&gt;&lt;/p&gt;
  </code></pre>
  
  <p>The <code>&lt;map&gt;</code> areas are something like this:</p>
  
  <pre><code>&lt;area shape="circle" coords="129,325,72" alt="1" href="javascript:numArray.push('1')"&gt;
  &lt;area shape="circle" coords="319,325,72" alt="2" href="javascript:numArray.push('2')"&gt;
  &lt;area shape="circle" coords="510,325,72" alt="3" href="javascript:numArray.push('3')"&gt;
  </code></pre>
  
  <p>So for example, if someone clicks on 1, then 2, then 3, I would like the array to display 123 in the <code>&lt;p&gt;</code>.</p>
  
  <p>When I use this though, it doesn't add anything to the array (or at least the values aren't displaying).</p>