Code:
function test( setValue )
{
var sel = document.getElementById("attop38");
for ( var i = 0; i < sel.options.length; ++i )
{
if ( sel.options[i].value == setValue )
{
sel.selectedIndex = i;
return; // found it and done
}
}
// no match...do nothing?
}
Quote:
|
so if i call the function with a 1993 it would select Navy as that is the id of 1993
|
No. "Navy" is the
.text for the <option> with a
.value of
1993. There is no id involved in this, except perhaps the id of the <select>. You are using the wrong terminology, which I guess confused the issue.