zoukankan
html css js c++ java
JS取得RadioButtonList的Value,Text及选中值等信息
<
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:RadioButtonList
>
<
input id
=
"
Button1
"
type
=
"
button
"
value
=
"
button
"
onclick
=
"
fn_GetRadioButtonListInfo();
"
/>
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
;
}
查看全文
相关阅读:
VIM中保存编辑的只读文件
ElasticSearch 入门
NET Core实现OAuth2.0的ResourceOwnerPassword和ClientCredentials模式
visual studio for mac的安装初体验
分库分表
Oracle执行计划
mybatis批量update(mysql)
查看mysql字符集及修改表结构--表字符集,字段字符集
13.1.17 CREATE TABLE Syntax
10.1.5 Connection Character Sets and Collations
原文地址:https://www.cnblogs.com/a121984376/p/1245886.html
最新文章
C++:在程序中获取全球唯一标识号(GUID或UUID)
Mariadb配置文件优化参数(仅供参考)
【MySQL】15个有用的MySQL/MariaDB性能调整和优化技巧
在CentOS7.4中安装jdk的几种方法及配置环境变量
Centos7通过yum安装最新MySQL
centos7 mysql数据库安装和配置
linux下MySQL停止和重启
MYSQL启用日志,和查看日志
Centos7(Firewall)防火墙开启常见端口命令
centos7 开启端口防火墙配置(如开启3306或者80端口)
热门文章
Java NIO的基本概念与使用
Windows 编译libcurl(openssl+zlib)(使用VC编译)
Qt使用预编译头文件Using Precompiled Headers(提升10倍以上)
怎样从一名程序员过度到项目经理(整理自csdn论坛) 选择自 whoopee 的 Blog
C ++ 17 技术上已经完成,C ++ 20 也在路上(有路线图)
delphi之多线程编程(尚未学习)
CURL常用命令
Elasticsearch 5.0Head插件
elasticsearch5.0版本的head安装
net平台下c#操作ElasticSearch详解
Copyright © 2011-2022 走看看