<script>
    function init(obj){
       for(var i=0;i<document.all.test.options.length;i++){
if(document.all.test.options[i].value==obj){
   document.all.test.selectedIndex=i;
   return;
}
       }
    }
</script><body onload="init('00002')">
<select name="test">
<option value="00001">test1</option>
<option value="00002">test2</option>
<option value="00003">test3</option>
</select>
</body>

解决方案 »

  1.   

    <html>
    <head>
    <script language=javascript>
    function posSelect()
    {
        var char = "00002";
    var size = document.all.test.options.length;
    var i = 0;
    for(;i<size;i++){
        if(document.all.test.options[i].value == char){
        document.all.test.options[i].selected = true;
    break;
    }
    }
    }
    </script>
    </head>
    <body>
    <center>
    <table width="340" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td>
          <select name="test">
    <option value="00001">test1</option>
    <option value="00002">test2</option>
    <option value="00003">test3</option>
      </select>
      <input name="position" value="position" type="button" onClick="posSelect();">
        </td>  
      </tr>
    </table>
    </center>
    </body>
    </html>
      

  2.   

    没有那么复杂的<select name="test">
    <option value="00001">test1</option>
    <option value="00002">test2</option>
    <option value="00003">test3</option>
    </select>
    <button onclick="JavaScript:test.value='00002';">测试</button>
      

  3.   

    直接给SELECT的value属性赋值就可以了
      

  4.   

    好属性.... 原来可以直接赋予value的,我还老想着.net里面的selectedValue属性呢,xixi...学到东西了,谢谢