Good day!
How can i make the first value in my array e.g currency[0] be the default value of my drop down list?
My code is as follows:
function addOption(selectbox,text,value )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
function initAll(){
var currency = new Array("Peso","Dollar","Euro","Yen","CAD");
var rate = new Array("0.02319", "1", "1.416", "0.012241", "1.027");
for (var i=0; i < currency.length;++i){
addOption(document.drop_list.Month_list, currency[i],rate[i]);
}
}
I want the default value be the first array…
<FORM name="drop_list">
<select name="Month_list">:
<Option value="" >-----</option> //what could i insert here?
</select><br>
</form>
You’re help would be highly appreciated.
In the end of initAll function put :