源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

JS获取DropDownList的value值与text值的示例代码

  • 时间:2022-01-08 07:59 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:JS获取DropDownList的value值与text值的示例代码
相关JS:
[u]复制代码[/u] 代码如下:
<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>
调用:
[u]复制代码[/u] 代码如下:
<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
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部