Get the error: DROPDOWN list is not a function - works in IE9

I'm trying to remove the default selected value in a drop-down list.

The call to the function is the following:
OnChange = "JavaScript:Remove_Default_Value (this); »

Here's the function:

function Remove_Default_Value(DROPDOWN) {
 var i = DROPDOWN.options.length - 1;
 for ( i; i >= 0; i--)
 {
  DROPDOWN(i).defaultSelected = false;
 }
} 

The error I get is "drop-DOWN list is not a function".

Any ideas is greatly appreciated.

It is not a function, but a table and you also use getElementsByTagName()

function Remove_Default_Value(DROPDOWN) {
 var i = DROPDOWN.getElementsByTagName("option").length - 1;
 for ( i; i >= 0; i-- )
 {
  DROPDOWN.getElementsByTagName("option")[i].defaultSelected = false;
 }
} 

A good place to ask for advice on web development is to the 'Web Standards Development/evangelism' MozillaZine forum.

Aid to this forum are better informed on issues related to web development.

You must register on MozillaZine forum site to post in this forum.

Tags: Firefox

Similar Questions

Maybe you are looking for