手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >JS获取DropDownList的value值与text值的示例代码
JS获取DropDownList的value值与text值的示例代码
摘要:相关JS:复制代码代码如下:functionSearchChange(){varddl=document.getElementById("D...

相关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>

调用:

复制代码 代码如下:

<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值的示例代码】相关文章:

javascript中一些util方法汇总

获得当前页面URL地址的三个JS代码

超酷右下浮出广告窗口代码

JavaScript的正则表达式中test()方法的使用

简介JavaScript中toTimeString()方法的使用

javascript获取select值的方法分析

javascript常用方法总结

让插入到 innerHTML 中的 script 跑起来的实现代码

3张图片循环组和(很有动感)

JS函数实现鼠标指向图片后显示大图代码

精品推荐
分类导航