title: De-select all html select options in a control that does not allow multiple selection
body: <p>I have a web page with several HTML Select controls that all allow multiple selection.  Next to each control we have a "Clear" button that de-selects all selected items in the control, with the onclick that looks something like this:</p>
  
  <pre><code>&lt;input type=button value="Clear" size=5 onclick="selectOptions('n.MyControl', false)"&gt;
  </code></pre>
  
  <p>The called Javascript code looks like this:</p>
  
  <pre><code>function selectOptions(controlName, bSelectItems)
  {
      for (i=0; i &lt; document.myForm[controlName].options.length; i++)
      {
          document.myForm[controlName].options[i].selected = bSelectItems;
      }
  
  }
  </code></pre>
  
  <p>It works really well with the Select controls that allow multiple selection, but I just added a Select control that does not allow multiple selection (i.e. does not have the "multiple" attribute), and this code does not clear it. If I add the "multiple" attribute, the Clear button starts working again, so I know it has something to do with the fact that I am not allowing multiple items to be selected.</p>
  
  <p>My question is, why does the above code not work and more importantly, how can I get my new Select control cleared in JavaScript? </p>