title: Selecting value of <select> tag in javascript. problem
body: <p>I have an external Javascript file and i am trying to <code>alert</code> the value of select tag. </p>
  
  <p>My <code>&lt;select&gt;</code> code looks like this:</p>
  
  <pre><code>&lt;select id="vote"&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      &lt;option value="2"&gt;2&lt;/option&gt;
      &lt;option value="3"&gt;3&lt;/option&gt;
      &lt;option value="4"&gt;4&lt;/option&gt;
      &lt;option value="5"&gt;5&lt;/option&gt;
      &lt;/select&gt;
  &lt;input type="button" value="vote" onclick="castvote();"&gt;
  </code></pre>
  
  <p>and the Javascript (which is external):</p>
  
  <pre><code>function castvote()
  {
      alert(document.vote.options[document.vote.selectedIndex].value);
  }
  </code></pre>
  
  <p>But I get the error "document.vote is undefined".</p>
  
  <p>Can someone help me with this. </p>
  
  <p>Best
  Zeeshan</p>