手机
当前位置:查字典教程网 >编程开发 >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值的示例代码】相关文章:

脚本写的IE右键助手

JavaScript通过事件代理高亮显示表格行的方法

JavaScript静态的动态

javascript获取select值的方法分析

javascript常用方法总结

网页常用特效代码整理

javascript小技巧 超强推荐第1/5页

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

JS+CSS实现仿触屏手机拨号盘界面及功能模拟完整实例

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

精品推荐
分类导航