设select的id为selectid
用selectid.options[i].text来访问/修改各个选项的文字;             
用selectid.options[i].value来访问/修改各个选项对应的值。
其中的i是下标。

解决方案 »

  1.   

    同意gdxy
    代码如下:
    <select id=slt1>
    <option>option1
    <option>option2
    </select>
    <button onclick=ChangeOptionText()>change</button>
    <script language=javascript>
    function ChangeOptionText()
    {
    slt1.options[0].innerText=prompt('input first option caption:',slt1.options[0].text);
    }
    </script>
      

  2.   

    <body onload="a(document.all.sel1.value);c(document.all.sel1.value,document.all.sel2.value)">
    <center>
    <select name=sel1 size=1 onchange="javascript:a(this.value);">
    <option value="" selected>year
    <script>
    <!--
    for(i=2001;i<=2050;i++)
    {
    document.write("<option value="+i+">"+i);
    }
    //-->
    </script>
    </select>
    &nbsp;
    <select name=sel2 size=1 onchange="javascript:c(document.all.sel1.value,this.value);">
    <option value="" selected>month
    </select>
    &nbsp;
    <select name=sel3 size=1>
    <option value="" selected>date
    </select>
    </center>
    <script>
    <!--
    function a(b)
    {
    var year=b;
    for(i=31;i>=1;i--)
    {
    document.all.sel3.options.remove(i);
    }
    switch(b)
    {
    case "":
    for(i=12;i>=1;i--)
    {
    document.all.sel2.options.remove(i);
    }
    break;
    default:
    for(i=1;i<=12;i++)
    {
    if(i<10) {i="0"+i}
    document.all.sel2.options[i]=new Option(i,i);
    }
    break;
    }
    }
    function c(d,e)
    {
    var year=d;
    var month=e;
    switch(e)
    {
    case "":
    for(i=31;i>=1;i--)
    {
    document.all.sel3.options.remove(i);
    }
    break;
    case "01":
    case "03":
    case "05":
    case "07":
    case "08":
    case "10":
    case "12":
    for(j=1;j<=31;j++)
    {
    if(j<10) {j="0"+j}
    document.all.sel3.options[j]=new Option(j,j);
    }
    break;
    case "04":
    case "06":
    case "09":
    case "11":
    document.all.sel3.options.remove(31);
    for(j=1;j<=30;j++)
    {
    if(j<10) {j="0"+j}
    document.all.sel3.options[j]=new Option(j,j);
    }
    break;
    case "02":
    document.all.sel3.options.remove(31);
    document.all.sel3.options.remove(30);
    document.all.sel3.options.remove(29);
    switch(d%4)
    {
    case 0:
    for(j=1;j<=29;j++)
    {
    if(j<10) {j="0"+j}
    document.all.sel3.options[j]=new Option(j,j);
    }
    break;
    default:
    for(j=1;j<=28;j++)
    {
    if(j<10) {j="0"+j}
    document.all.sel3.options[j]=new Option(j,j);
    }
    break;
    }
    }
    }
    //-->
    </script>
    这是一个选择日期的脚本,自己体会!
      

  3.   

    给你个例子吧!!!<script language="javascript">
    <!--
    function InsertSle(val1,val2,sle)
    {
    var newsle=new Option(val1,val2);
    sle.add(newsle);
    }
    function DelSle(sle,indexsle)
    {
    sle.options[indexsle]=null;
    }
    function DelAndIn(sle1,sle2)
    {
             for(i=0;i<sle1.length;i++)
    if(sle1.options[i].selected){
         InsertSle(sle1.options[i].text,sle1.options[i].value,sle2);
    DelSle(sle1,i);
                      }
    }
          function MoveAll(sle1,sle2)
          {
        var i=sle1.length-1;
        for(;i>=0;i--)
            {
             InsertSle(sle1.options[i].text,sle1.options[i].value,sle2);
    DelSle(sle1,i);
            }
          }