title: Javascript to Select item from listbox by value number
body: <p>I have a listbox on a page:</p>
  
  <pre><code>&lt;select id="user_list" name="user_list" size="21" style="width:200px;"&gt;
    &lt;option value=1&gt;User 1&lt;/option&gt;
    &lt;option value=2&gt;User 2&lt;/option&gt;
    &lt;option value=3&gt;User 3&lt;/option&gt;
    &lt;option value=5&gt;User 5&lt;/option&gt;
    &lt;option value=6&gt;User 6&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>And if I select a item I can get the current value by using the following code:</p>
  
  <pre><code>var el = document.getElementById("user_list");
  var val = el[el.selectedIndex].value;
  alert(val);
  </code></pre>
  
  <p>However, the problem I am having is that I want to be able to search the user_list (start from 1) for the next avaliable number (in my example above it will alert 4, as that is missing)</p>
  
  <p>But I have tried using:</p>
  
  <pre><code>var el = document.getElementById("user_list");
  var val = el[4].value;
  alert(val);
  </code></pre>
  
  <p>but it doesn't work, does anyone know what I am doing wrong?</p>
  
  <p>My guess is that var val = el[4].value; is wrong.. ?</p>