JS如何获取RadiobuttonList的选中值
2012-07-05 15:21
281 查看
JS代码:
<script language="javascript" type="text/javascript">
function RadioButtonList1Changed() {
var vRbtid = document.getElementById("RadioButtonList1");
//得到所有radio
var vRbtidList = vRbtid.getElementsByTagName("INPUT");
for (var i = 0; i < vRbtidList.length; i++) {
if (vRbtidList[i].checked) {
var text = vRbtid.cells[i].innerText;
var value = vRbtidList[i].value;
alert("选中项的text值为" + text + ",value值为" + value);
}
}
}
</script>
HTML:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" onClick="return RadioButtonList1Changed()">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:RadioButtonList>
<script language="javascript" type="text/javascript">
function RadioButtonList1Changed() {
var vRbtid = document.getElementById("RadioButtonList1");
//得到所有radio
var vRbtidList = vRbtid.getElementsByTagName("INPUT");
for (var i = 0; i < vRbtidList.length; i++) {
if (vRbtidList[i].checked) {
var text = vRbtid.cells[i].innerText;
var value = vRbtidList[i].value;
alert("选中项的text值为" + text + ",value值为" + value);
}
}
}
</script>
HTML:
<asp:RadioButtonList ID="RadioButtonList1" runat="server" onClick="return RadioButtonList1Changed()">
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
</asp:RadioButtonList>
相关文章推荐
- JS如何获取RadiobuttonList的选中值
- JS 如何获取radio选中后的值及不选择取radio的值
- 使用js如何获取treeview控件的当前选中的节点
- js如何获取选中option的title值
- JS 如何获取radio选中后的值并且不选择也能获取radio的值
- js获取RadioButtonList的Value/Text及选中值等信息实现代码
- WdatePicker 如何在js里获取到选中的值
- js获取RadioButtonList的Value/Text及选中值等信息实现代码
- JS如何获取和改变 单选按钮radio选中的值
- JS 如何获取radio选中后的值及不选择取radio的值
- ASP.NET中JS获取服务器控件radiobuttonlist和DropDownList选中值
- 如何获取 chosen chosen.jquery.js 选中的值
- JS 如何获取radio选中后的值
- js如何获取asp.net服务器端控件的值(label,textbox,dropdownlist,radiobuttonlist等)
- JS 如何获取 RadioButtonList 被选中的值
- js如何获取选中的单选框
- JS获取RadioButtonList的选中值
- 如何获取 chosen chosen.jquery.js 选中的值
- js如何获取url传值
- js和Jquery获取选中select值和文本对比