欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS獲取DropDownList的value值與text值的示例代碼

 更新時間:2014年01月07日 09:29:23   作者:  
本篇文章主要是對JS獲取DropDownList的value值與text值的示例代碼進行了介紹,需要的朋友可以過來參考下,希望對大家有所幫助
相關JS:
復制代碼 代碼如下:

<script type="text/javascript" language="javascript">
    function SearchChange()
    {
        var ddl = document.getElementById("DropDownList1")  
        var index = ddl.selectedIndex;  

        var Value = ddl.options[index].value;  
        var Text = ddl.options[index].text;

        alert(Value);
    }
    </script>

調(diào)用:
復制代碼 代碼如下:

<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

相關文章

最新評論