can: Warum klappt diese elements Abfrage nicht?

Beitrag lesen

Oki, Punkt für Dich!

<script language="JavaScript" type="text/JavaScript">
<!--

function showAll(el)
{
    var all = el.form[el.name];
    alert('es gibt ' + all.length + ' Listen mit dem Namen ' + el.name);

for(var i = 0; i < all.length; i++)
  if(document.forms[0].elements[i].selected == true)
   alert(document.forms[0].elements[i].selectedIndex);

}

//-->
</script>

Im HTML steht:

<form id="form1" name="form1" method="post" action="">
 <select name='sortieren[]' onchange="showAll(this)">
 <option value='0-1' selected>0-1</option>
 <option value='2-3' >2-3</option>
 <option value='4-5' >4-5</option>
 <option value='6-7' >6-7</option>
 <option value='8-9' >8-9</option>
 <option value='10-11' >10-11</option>
 </select>

<select name='sortieren[]' onchange="showAll(this)">
 <option value='0-1' >0-1</option>
 <option value='2-3' selected>2-3</option>
 <option value='4-5' >4-5</option>
 <option value='6-7' >6-7</option>
 <option value='8-9' >8-9</option>
 <option value='10-11' >10-11</option>
 </select>

<select name='sortieren[]' onchange="showAll(this)">
 <option value='0-1' >0-1</option>
 <option value='2-3' >2-3</option>
 <option value='4-5' selected>4-5</option>
 <option value='6-7' >6-7</option>
 <option value='8-9' >8-9</option>
 <option value='10-11' >10-11</option>
 </select>