title: how to store value of multiselect listbox in javascript
body: <p>I have one multiselect listbox in my HTMl.
  I want to get values of selected items of listbox in javascript</p>
  
  <p>My html code:</p>
  
  <pre><code>&lt;select id="schools" size="5" multiple="multiple"&gt;
  &lt;option value="352"&gt;Byskovskolen&lt;/option&gt;
  &lt;option value="355"&gt;Heldagsskolen Specialtilbud&lt;/option&gt;
  &lt;option value="372"&gt;Plejecenter Solbakken&lt;/option&gt;
  &lt;/select&gt; 
  </code></pre>
  
  <p></p>
  
  <p>My Javascript code:</p>
  
  <pre><code>function getData()
  {
  var allSchools = [];
   var s = document.getElementById("schools");
              alert("schools lenght  " + s.options.length);
              for (var i = 0; i &lt; s.options.length; i++) {
                  if (s.options[i].selected == true) {
                      var schoolid = s.options[i].value;
                      alert(s.options[i].value);
                          allSchools.push(schoolid);
                  }
              }
  }
  </code></pre>
  
  <p>Values can be seen alerted with alert box but not getting stored in variable.</p>
  
  <p>How can I store it in variable.</p>