<SELECT id="hdnFenQu">
<OPTION VALUE="a">
1</OPTION>
<OPTION VALUE="b">
2</OPTION>
<OPTION VALUE="c">
3</OPTION>
</SELECT>
<script>
  document.getElementById("hdnFenQu").selectedIndex = 1;   //value为'b'的option选中
</script>

解决方案 »

  1.   

    <body MS_POSITIONING="GridLayout">
    <form id="Form1" method="post" runat="server">
    <SELECT id="ConID">

    </SELECT>
    </form>
    <SCRIPT>
    function window.onload()
    { var ConID=document.getElementById ("ConID");
      var Data = new Array();
      for(var  i=0;i<10;i++)
      Data[i]=i;
      for(i=0;i<Data.length ;i++)                          
          {  var newOption = document.createElement("OPTION");
             newOption.text=Data[i];
             newOption.value=Data[i];
             ConID.options.add(newOption);
           }
        ConID.selectedIndex=1;//直接写到这里行,但我想用另外的函数
        //dd();这样为什么不行
    }
    function dd()
    {
     var ConID=document.getElementById ("ConID");
      ConID.selectedIndex=1
    }
    </SCRIPT>
    </body>