<asp:dropdownlist id="ddlBusCode" runat="server"></asp:dropdownlist>
 如何用JS获取下拉框的值?

解决方案 »

  1.   

    var ddl = document.getElementById("ddlBusCode")
    var index = ddl.seletedIndex;var Value = ddl.options[index].value;
    var Text  = ddl.options[index].text;
      

  2.   

    javascript:
    var aaa=ddlBusCode.options[this.selectedIndex].value;
      

  3.   

    javascript:
    var aaa=ddlBusCode.options[ddlBusCode.selectedIndex].value;
      

  4.   

    ld_thinking的就行
    var ddl = document.getElementById("ddlBusCode")
    var index = ddl.seletedIndex;var Value = ddl.options[index].value;
    var Text  = ddl.options[index].text;
      

  5.   

    var ksobj=document.getElementById("ksobj");
    var tempksrq=ksobj.options[ksobj.selectedIndex].value;
      

  6.   

    var aaa=ddlBusCode.options[ddlBusCode.selectedIndex].value;
      

  7.   

    dropdownlist的值是绑定的,也可以么?
    我用了报错,说options[...].VLLUE为空
      

  8.   

    <INPUT id="ms" style="Z-INDEX: 103; LEFT: 384px; POSITION: absolute; TOP: 388px" type="text" value ="javascript:ddlBusCode.options[ddlBusCode.selectedIndex].value;">
    ------------------------------------------------------------------------------------
    为什么文本框不能显示出来呢??????
      

  9.   

    <INPUT id="ms" style="Z-INDEX: 103; LEFT: 384px; POSITION: absolute; TOP: 388px" type="text" value ="javascript:ddlBusCode.options[ddlBusCode.selectedIndex].value;">
    ------------------------------------------------------------------------------------
    为什么文本框不能显示出来呢??????
      

  10.   

    var c=document.all('drlstC')
    string dd= c.options[c.selectedIndex].value
      

  11.   

    <INPUT id="ms" style="Z-INDEX: 103; LEFT: 384px; POSITION: absolute; TOP: 388px" type="text" value ="javascript:ddlBusCode.options[ddlBusCode.selectedIndex].value;">
    ------------------------------------------------------------------------------------
    为什么文本框不能显示出来呢??????
      

  12.   

    添加元素
    opt = new Option(text,value);
    objSel2.options[indexvalue] = opt;
    另要注意大小写
      

  13.   

    or  document.all['ddlBusCode'].value=...
      

  14.   

    http://singlepine.cnblogs.com/articles/265678.htmlvar province=document.getElementById("DropDownList1");
    var pindex = province.selectedIndex;
    var pValue = province.options[pindex].value;
    var pText  = province.options[pindex].text;
      

  15.   

    to: jacky125() 
    那怎样把获取下拉框的值在前台放进文本框呢????
    大家帮忙想一想
    -----------------------------------------
    var province=document.getElementById("DropDownList1");
    var pindex = province.selectedIndex;
    var pValue = province.options[pindex].value;
    var pText  = province.options[pindex].text;document.getElementById("<%=TextBox1.ClientID%>").innerText=pValue+"|"+pText;
      

  16.   

    <script>
        function show3(ddl)
        {
            document.getElementById("txtName").value=ddl.options[ddl.selectedIndex].value;
        }
    </script>
    <asp:DropDownList ID="ddlName" runat="server" OnChange="show3(this)">
            <asp:ListItem Value="Jack"></asp:ListItem>
            <asp:ListItem Value="Tom"></asp:ListItem>
            <asp:ListItem Value="Mike"></asp:ListItem>
    </asp:DropDownList>
    -----------------------
    结贴给分!!!!不结贴就不尊重别人的劳动成果!
      

  17.   

    补充上面的代码,少了一个控件!
     <asp:TextBox ID="txtName" runat="server"></asp:TextBox>