zoukankan
html css js c++ java
JS取得RadioButtonList的Value,Text及选中值等信息
HTML部分
--------
Code
<
asp:RadioButtonList
ID
="RadioButtonList1"
runat
="server"
RepeatColumns
="4"
RepeatDirection
="horizontal"
>
<
asp:ListItem
Value
="1"
Text
="A1"
></
asp:ListItem
>
<
asp:ListItem
Value
="2"
Text
="A2"
></
asp:ListItem
>
<
asp:ListItem
Value
="3"
Text
="A3"
></
asp:ListItem
>
<
asp:ListItem
Value
="4"
Text
="A4"
></
asp:ListItem
>
<
asp:ListItem
Value
="5"
Text
="A5"
></
asp:ListItem
>
<
asp:ListItem
Value
="6"
Text
="A6"
></
asp:ListItem
>
<
asp:ListItem
Value
="7"
Text
="A7"
></
asp:ListItem
>
<
asp:ListItem
Value
="8"
Text
="A8"
></
asp:ListItem
>
<
asp:ListItem
Value
="9"
Text
="A9"
></
asp:ListItem
>
<
asp:ListItem
Value
="10"
Text
="A10"
></
asp:ListItem
>
</
asp:RadioButtonList
>
<
input
id
="Button1"
type
="button"
value
="button"
onclick
="fn_GetRadioButtonListInfo();"
/>
JS部分
-------
Code
function
fn_GetRadioButtonListInfo()
{
//
取得RadioButtonList的集合
var
radListItems
=
document.all(
"
RadioButtonList1
"
);
if
(radListItems
==
null
)
{
alert(
"
相关对象对空
"
);
return
false
;
}
//
弹出RadioButtonList的Item的个数
var
radListItesCount
=
radListItems.length
-
1
;
alert(
"
Item个数
"
+
radListItesCount);
var
radListCheckedValue
=
""
;
//
遍历Item的Text和Value
for
(
var
i
=
1
; i
<=
radListItesCount ; i
++
)
{
var
itemInfo
=
""
;
itemInfo
+=
"
第
"
+
i
+
"
Item
"
;
//
Value
itemInfo
+=
"
Value:
"
+
radListItems[i].value;
//
Text
//
itemInfo += " Text: "+ radListItems[i].nextSibling.innerText ;
//
或者
itemInfo
+=
"
Text:
"
+
radListItems[i].parentElement.childNodes[
1
].innerText ;
//
是否是选中
itemInfo
+=
"
是否选中:
"
+
radListItems[i].checked;
//
if
(radListItems[i].checked)
radListCheckedValue
=
radListItems[i].value;
alert(itemInfo);
}
if
(radListCheckedValue
==
""
)
{
alert(
"
没有选中值
"
);
}
else
{
alert(
"
选中Value 为 :
"
+
radListCheckedValue);
}
return
false
;
}
查看全文
相关阅读:
顺序容器删除元素 vector list deque
smart_pointer example
c++ new bad_alloc
mat工具MemoryAnalyzer进行分析java内存溢出hprof文件
centos7.2环境elasticsearch-5.0.1+kibana-5.0.1+zookeeper3.4.6+kafka_2.9.2-0.8.2.1部署详解
配置zabbix当内存剩余不足10%的时候触发报警
zabbix通过curl命令判断web服务是否正常并自动重启服务
日志分析工具ELK配置详解
zabbix3.0.4监控mysql主从同步
使用percona-xtrabackup实现对线上zabbix监控系统数据库mariadb5.5.47的主从同步
原文地址:https://www.cnblogs.com/freeliver54/p/1126831.html
最新文章
C++ replace replace_if replace_copy replace_copy_if
C++ fill fill_n generate generate_n
C++ STL swap_range
C++ transform for_each
C++ ++pos vs pos++
C++ STL transform
C++ STL copy copy_backward
C++ STL 已序区间查找算法
c++ STL find search
C++ list 查找
热门文章
c++ STL 最大值最小值
c++ 容器中元素计数
c++ set multiset
c++ Container print
c++ map multimap操作
c++ string compare
c++ string操作
c++ string构造函数学习
c++ vector容器自增长
vector swap
Copyright © 2011-2022 走看看