JS获取DropDownList的value值与text值

时间:2014-05-30 04:53:51   收藏:0   阅读:175
<script type="text/javascript" language="javascript">
    function SearchChange()
    {
        var ddl = document.getElementById(‘<%=DropDownList1.ClientID %>‘)   
        var index = ddl.selectedIndex;   
         
        var Value = ddl.options[index].value;   
        var Text = ddl.options[index].text;
        
        alert(Value);
    }
    </script>
<asp:DropDownList ID="DropDownList1" runat="server" onchange="SearchChange();">
    <asp:ListItem Value="0">111</asp:ListItem>
    <asp:ListItem Value="1">222</asp:ListItem>
    <asp:ListItem Value="2">333</asp:ListItem>
</asp:DropDownList>

JS获取DropDownList的value值与text值,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!