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

光标定位等TextRange的操作的范例代码

javascript中一些util方法汇总

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

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

jQuery实现不断闪烁文字的方法

网页常用特效代码整理

Js和JQuery获取鼠标指针坐标的实现代码分享

Javascript实现广告页面的定时关闭

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

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

精品推荐
分类导航