1 Kwi 2008

Inwersja SELECT, ComboBoxa

function inwersja() {
  len = document.test.branze.length

  for (i = 0; i < len; i++) {
    if (document.test.branze.options[i].selected)
      document.test.branze.options[i].selected = false
    else
      document.test.branze.options[i].selected = true
  }
}
<FORM METHOD=POST ACTION="" NAME="test">
  <select name="branze" multiple size="5">
    <option selected value="0">------ wybierz ------</option>
    <option value="1">5</option>
    <option value="2">20</option>
    <option value="3">100</option>
  </select>
  <INPUT TYPE="button" Value="INWERSJA" onClick="inwersja()">
</FORM>