G
GD
Hi,
The following code:
<script language="javascript" type="text/javascript">
function lstbox(lstval) {
switch(lstval){
case "Amphipoda" :
document.getElementById("clas").add(new
Option("Gammaridae","Gammaridae"));
break
default : alert("Unknown");
}
}
</script>
Works in IE6 and Opera but not in Mozilla based browsers (NN &
Firefox), causing the following error:
Error: uncaught exception: [Exception... "Not enough arguments
[nsIDOMHTMLSelectElement.add]" nsresult: "0x80570001
(NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame ::
http://localhost/IndicatorsSp/Indicator_search.php?spl :: lstbox ::
line 58" data: no]
What arguments am missing? And is it possible to get it to work in all
browsers?
As an extra, I'd like to clear the listbox when a new switch statement
is triggered.
Many thanks
Dan
The following code:
<script language="javascript" type="text/javascript">
function lstbox(lstval) {
switch(lstval){
case "Amphipoda" :
document.getElementById("clas").add(new
Option("Gammaridae","Gammaridae"));
break
default : alert("Unknown");
}
}
</script>
Works in IE6 and Opera but not in Mozilla based browsers (NN &
Firefox), causing the following error:
Error: uncaught exception: [Exception... "Not enough arguments
[nsIDOMHTMLSelectElement.add]" nsresult: "0x80570001
(NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame ::
http://localhost/IndicatorsSp/Indicator_search.php?spl :: lstbox ::
line 58" data: no]
What arguments am missing? And is it possible to get it to work in all
browsers?
As an extra, I'd like to clear the listbox when a new switch statement
is triggered.
Many thanks
Dan