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

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

JavaScript实现广告的关闭与显示效果实例

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

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

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

javascript常用方法总结

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

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

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

javascript获取select值的方法分析

精品推荐
分类导航