M
mike
I need to be able to select a specific option in a select list. This is
what I have:
<select name="mysel">
<option value=""></option>
<option value="1">First</option>
<option value="2" selected>First</option>
<option value="3">First</option>
</select>
But I want to select the first option. Here is my code:
var frm_objs = document.report.elements;
for ( j=0; j<frm_objs.length; j++ )
{
if ( frm_objs[j].type=='select-one' )
{
if ( frm_objs[j].name=='mysel' )
{
frm_objs[j].options[0].selected=true;
}
}
}
I think is should select the first ooption but it does not. The default
option 2 remains selected.
Any help is apreciated.
what I have:
<select name="mysel">
<option value=""></option>
<option value="1">First</option>
<option value="2" selected>First</option>
<option value="3">First</option>
</select>
But I want to select the first option. Here is my code:
var frm_objs = document.report.elements;
for ( j=0; j<frm_objs.length; j++ )
{
if ( frm_objs[j].type=='select-one' )
{
if ( frm_objs[j].name=='mysel' )
{
frm_objs[j].options[0].selected=true;
}
}
}
I think is should select the first ooption but it does not. The default
option 2 remains selected.
Any help is apreciated.