title: Getting the value of a SELECT element with javascript
body: <p>I have a form that user should select start and end time of an event (only hour and minute). I want to validate the form in such a way that start time of course should be smaller than end time.</p>
  
  <p>For this I have some select elements like this:</p>
  
  <pre><code>&lt;select name="start_timeHour"&gt;
    &lt;option value="00"&gt;00&lt;/option&gt;
    &lt;option value="01"&gt;01&lt;/option&gt;
    &lt;option value="02"&gt;02&lt;/option&gt;
    &lt;option value="03"&gt;03&lt;/option&gt;
    &lt;!-- UP TO 24 --&gt;
  &lt;/select&gt;
  
  &lt;select name="start_timeMinutes"&gt;
  .....
  &lt;select name="end_timeHour"&gt;
  .....
  &lt;select name="end_timeMinutes"&gt;
  &lt;!-- I think you got the idea! --&gt;
  </code></pre>
  
  <p>So I want to get the value of selected options for start and end (hours and minutes and compare them in an if statement). To start the things, I tried to get the value of <strong>start_timeHour</strong> but the alert function only shows <strong>undefined</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function validateTime()
      {
          var startHour = 
              document.forms["add_new_schedule"]["start_timeHour"].value;
          alert("Start hour is ".startHour );
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Can you tell me what is the problem and how can I manage this?</p>