<select name="cboPlaces" id="cboPlaces">
<option value="3">Countryside</option>
<option value="4">Forest</option>
<option value="5">Mountain</option>
<option value="6">Desert</option>
<option value="7">Jungle</option>
<option value="7">Swamp</option>
<option value="8">River</option>
<option value="12">Town</option>
<option value="9">Sea</option>
</select>
Hello - when the combo loads, how do I set the default selected item
using javascript?
For instance I want the item to be the one with a value of 12, (Town)
How can I use the actual value of the item to make that item the
default displayed item?
Do I have to loop through every item in the combo and set the
selectedIndex to the item which has a value of 12? [I suspect I do
but I just want confirmation]
function doInit()
{
var combo = document.getElementById('cboPlaces');
for (var i=0 ; i <= combo.length; i++)
if (combo.value=='12')
combo.selectedIndex = i;
return true;
}