会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
欲速则不达
先用户之优而优,后用户之乐而乐
javascript中获取radiobuttonlist选中值
<%
@ Page language
=
"
c#
"
Codebehind
=
"
WebForm1.aspx.cs
"
AutoEventWireup
=
"
false
"
Inherits
=
"
ajaxselect.OnmouseTitle.WebForm1
"
%>
<!
DOCTYPE HTML PUBLIC
"
-//W3C//DTD HTML 4.0 Transitional//EN
"
>
<
HTML
>
<
HEAD
>
<
title
>
WebForm1
</
title
>
<
meta content
=
"
Microsoft Visual Studio .NET 7.1
"
name
=
"
GENERATOR
"
>
<
meta content
=
"
C#
"
name
=
"
CODE_LANGUAGE
"
>
<
meta content
=
"
JavaScript
"
name
=
"
vs_defaultClientScript
"
>
<
meta content
=
"
http://schemas.microsoft.com/intellisense/ie5
"
name
=
"
vs_targetSchema
"
>
<
script language
=
"
javascript
"
>
//
******************
//
Author:owendu
//
date:11.13
//
******************
function getvalue()
{
var b
=
document.all.rbtid.length
var a
=
document.getElementById(
"
rbtid
"
).rows.length;
//
alert(b);结果为5
//
alert(a);结果为4
//
for(var i=0;i<b-1;i++)这样也行
for
(var i
=
0
;i
<
a;i
++
)
{
var ss
=
"
rbtid_
"
+
i;
var aa
=
document.getElementById(ss).value;
//
if(eval('document.all.rbtid_'+i).checked==true)
//
这样也行 eval()函数能将数据符串转成js运行
var bb
=
document.getElementById(ss);
if
(document.getElementById(ss).
checked
)
//
注意checked不能写成Checked,要不然不成功
{
alert(aa);
break
;
}
}
}
</
script
>
</
HEAD
>
<
body MS_POSITIONING
=
"
GridLayout
"
>
<
form id
=
"
Form1
"
method
=
"
post
"
runat
=
"
server
"
>
<
FONT face
=
"
宋体
"
>
<
asp:radiobuttonlist id
=
"
rbtid
"
style
=
"
Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px
"
runat
=
"
server
"
Width
=
"
216px
"
Height
=
"
176px
"
name
=
"
rbtid
"
>
<
asp:ListItem Value
=
"
0
"
>
0
</
asp:ListItem
>
<
asp:ListItem Value
=
"
1
"
Selected
>
1
</
asp:ListItem
>
<
asp:ListItem Value
=
"
2
"
>
2
</
asp:ListItem
>
<
asp:ListItem Value
=
"
3
"
>
3
</
asp:ListItem
>
</
asp:radiobuttonlist
><
INPUT style
=
"
Z-INDEX: 102; LEFT: 184px; POSITION: absolute; TOP: 256px
"
onclick
=
"
getvalue()
"
type
=
"
button
"
value
=
"
Button
"
></
FONT
>
</
form
>
</
body
>
</
HTML
>
posted on
2006-11-13 17:03
asdsd
阅读(
6733
) 评论(
5
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
导航
博客园
首页
新随笔
联系
订阅
管理
公告