JS获取DropDownList的value值与text值
2011-12-07 11:08
411 查看
相关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
<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值
- JS获取DropDownList的value值与text值
- JS获取DropDownList的value值与text值
- JS获取DropDownList的value值与text值的示例代码
- 利用js获取select的value和text值
- js获取<select>下拉菜单的value值和text值
- JS获取DropDownList的value值与text值的示例代码
- 可编辑的下拉框,以及js获取DropDownList的Text和Value
- js获取dropdownlist的text/value
- JS获取DropDownList 选中值的value
- JS获取DropDownList的value值与text值的示例代码
- js获取<select>标签value值及text值
- JS获取DropDownList的value值与text值.txt
- jquery获取dropdownlist的value和text值
- js获取<select>标签value值及text值
- JS获取DropDownList的value与text值
- Vue.js获取被选择的option的value和text值
- 可编辑的下拉框,以及js获取DropDownList的Text和Value
- 通过js获取DropDownList控件的Value值
- jquery获取ASP.NET服务器端控件dropdownlist和radiobuttonlist生成客户端HTML标签后的value和text值