Q:

Looping hide option not working after select another option with javascript

i have -/+50 select option with looping.
not work hide option after select another with javascript?
work only 4 select option. I've changed the value, but it still does not work.
Javascript code :
<script type="text/javascript">
function check() {
  d=document;
  myArray = [];
  for (h=1;h<4;h++) {
    myArray[h] = d.getElementById('drop'+(h+1)).value;
  }
  for (a=1;a<4;a++) {
    for (b=1;b<4;b++) {
    d.getElementById('drop'+(a+1)).options[b].style.display = "block";
      for (c=1;c<4;c++) {
        if(d.getElementById('drop'+(a+1)).options[b].value == myArray[c]) {
          d.getElementById('drop'+(a+1)).options[b].style.display = "none";
        }
      }
    }
  }
}
</script>

Looping select :
<select id="drop1" name="drop" onchange="check();"> 
  <option value="0"></option>
  <option value="3">One</option>
  <option value="5">Two</option>
  <option value="1">Three</option>
</select>

--------- looping select id="drop50" -------------

Thanks in advance :)

A:

change javascript code :)
<script type="text/javascript">
function check(element)
{
  d=document;
  drops = d.getElementsByName('drop').length;
  opts = 99;
  for (i=1;i<drops+1;i++)
  {
    if (element.id != 'drop'+i && element.value != '0')
    {
      for (z=0;z<opts;z++)
      {
        if (d.getElementById('drop'+i).options[z].value == element.value)
        {
          d.getElementById('drop'+i).options[z] = null;
          break;
        }
      }
    }
  }
}
</script>

