<script language="javascript">
window.banksaveplandate= "<select name='paydate' style='width:100'>&nbsp;<option style='border:0' name='paydate' id='radio0' value='28'>每月28日&nbsp;<option style='border:0' name='paydate' id='radio1' value='27'>每月27日&nbsp;<option style='border:0' name='paydate' id='radio2' value='26'>每月26日&nbsp;<option style='border:0' name='paydate' id='radio3' value='25'>每月25日&nbsp;<option style='border:0' name='paydate' id='radio4' value='24'>每月24日&nbsp;<option style='border:0' name='paydate' id='radio5' value='23'>每月23日&nbsp;</select>";
</script><script language="javascript">
    document.getElementById("td_paydate").innerHTML = window["banksaveplandate];
</script>
<td width="35%" align="left" id="td_paydate"></td>俺的问题是:怎么获取选中的下拉框的值!!谢谢各位大哥大姐!

解决方案 »

  1.   


    var sel=document.getElementsByName("paydate")[0];
    var selvalue= sel.options[sel.options.selectedIndex].value//你要的值
      

  2.   

    <script language="javascript">
    window.banksaveplandate= "<select id='paydate' name='paydate' style='width:100'>&nbsp;
    <option style='border:0'  value='28'>每月28日&nbsp;</option>
    <option style='border:0'  value='27'>每月27日&nbsp;</option>
    <option style='border:0'  value='26'>每月26日&nbsp;</option>
    <option style='border:0'  value='25'>每月25日&nbsp;</option>
    <option style='border:0'  value='24'>每月24日&nbsp;</option>
    <option style='border:0'  value='23'>每月23日&nbsp;</option>
    </select>";
    </script>
    <script language="javascript">
    function getv(id){
    var o=document.getElementById(id);
    var v=o.options[o.selectedIndex].value;
    return v;
    }
    document.getElementById("td_paydate").innerHTML = getv("paydate");
    </script>
      

  3.   

    漏了一个点
    var v=o.options[o.options.selectedIndex].value; 
      

  4.   

    JS 都是对于 HTML的操作!!!
    var o=document.getElementById(id);   获取 下拉控件!
    for 循环 (Tagname="option" 的值 <标签为 option>)
    发现 selected=selected  就是 你选择的下拉至!返回OK
      

  5.   

    下拉框选中的值,document.getElementById("下拉框ID").value
      

  6.   

    <html>
    <head>
    <title>
    将下拉列表选中的值显示在表格中
    </title>
    <script language="JavaScript" >
    function getSelected() 
      {
       var td_paydate = document.getElementById("td_paydate");
       var optionCollection = document.getElementById("paydate").options;
       //var optionCollection = document.form1.paydate.options;
       for(i=0;i<optionCollection.length;i++)
       {
       if(optionCollection[i].selected)
       {
       td_paydate.innerText = optionCollection[i].text;
       break;
       }
       }
      }
      
    </script>
    </head>
    <body>
    <form action="#" method="get" name="form1" >  <!--#提交到当前网页-->
    <select id="paydate" name="paydate" size="4" onchange="getSelected();">

    <option value="1" selected >1号
    </option>
    <option  value="2" >2号
    </option>
    <option value="3" >3号
    </option>
    <option value="4" >4号
    </option>
    <option value="5" >5号
    </option>
    <option  value="6" >6号
    </option>
    <option value="7" >7号
    </option>
    </select>
    <input type="submit" value=" 提交" >
    </form>
    <table border="2px">
    <tr>
    <td id="td_paydate">初始值:0
    </td>
    </tr>
    </table>
    </body>
    </html>
      

  7.   

    var   Obj   =   document.getElementById("selectID");   
        
      Obj.option[Obj.selectedIndex].value   var   selectobj   =   ...   ///获得select   
      var   cels   =   selectobj.options;   
      var   selectvalue   ;   //   
      for   (i=0;   i<   cols.length;   i++)   
      {   
            var   op   =   cels[i];   
          if(   op.Selected   )   
          {   
              selectvalue   =   op.value;   
          }   
      }   
      window.document.getElementById("SELECT").options[window.document.getElementById("SELECT").selectedIndex].text;  你自己选择吧 
      

  8.   

    var   Obj   =   document.getElementById("selectID");
    var selectedValue=Obj.value;就可以获得选中的option的value值了。