javascript中获取radiobuttonlist选中值

None.gif <% @ Page language = " c# "  Codebehind = " WebForm1.aspx.cs "  AutoEventWireup = " false "  Inherits = " ajaxselect.OnmouseTitle.WebForm1 "   %>
None.gif
<! DOCTYPE HTML PUBLIC  " -//W3C//DTD HTML 4.0 Transitional//EN "   >
None.gif
< HTML >
None.gif    
< HEAD >
None.gif        
< title > WebForm1 </ title >
None.gif        
< meta content = " Microsoft Visual Studio .NET 7.1 "  name = " GENERATOR " >
None.gif        
< meta content = " C# "  name = " CODE_LANGUAGE " >
None.gif        
< meta content = " JavaScript "  name = " vs_defaultClientScript " >
None.gif        
< meta content = " http://schemas.microsoft.com/intellisense/ie5 "  name = " vs_targetSchema " >
None.gif        
< script language = " javascript " >
None.gif        
None.gif        
// ******************
None.gif        
// Author:owendu
None.gif        
// date:11.13
None.gif        
// ******************
None.gif
        function  getvalue()
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif        var b
=document.all.rbtid.length
InBlock.gif        var a
=document.getElementById("rbtid").rows.length; 
InBlock.gif        
//alert(b);结果为5
InBlock.gif        
//alert(a);结果为4
InBlock.gif        
//for(var i=0;i<b-1;i++)这样也行
InBlock.gif
        for(var i=0;i<a;i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif        
dot.gif{
InBlock.gif          var ss
="rbtid_"+i;
InBlock.gif          var aa
=document.getElementById(ss).value;
InBlock.gif          
//if(eval('document.all.rbtid_'+i).checked==true) //这样也行 eval()函数能将数据符串转成js运行
InBlock.gif
          var bb=document.getElementById(ss);
InBlock.gif          
if(document.getElementById(ss).checked)  //注意checked不能写成Checked,要不然不成功
ExpandedSubBlockStart.gifContractedSubBlock.gif
           dot.gif{
InBlock.gif                  alert(aa);
InBlock.gif                  
break;
ExpandedSubBlockEnd.gif           }
      
InBlock.gif        
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif        }

None.gif        
</ script >
None.gif    
</ HEAD >
None.gif    
< body MS_POSITIONING = " GridLayout " >
None.gif        
< form id = " Form1 "  method = " post "  runat = " server " >
None.gif            
< FONT face = " 宋体 " >
None.gif                
< asp:radiobuttonlist id = " rbtid "  style = " Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px "  runat = " server "
None.gif                    Width
= " 216px "  Height = " 176px "  name = " rbtid " >
None.gif                    
< asp:ListItem Value = " 0 " > 0 </ asp:ListItem >
None.gif                    
< asp:ListItem Value = " 1 "  Selected > 1 </ asp:ListItem >
None.gif                    
< asp:ListItem Value = " 2 " > 2 </ asp:ListItem >
None.gif                    
< asp:ListItem Value = " 3 " > 3 </ asp:ListItem >
None.gif                
</ asp:radiobuttonlist >< INPUT style = " Z-INDEX: 102; LEFT: 184px; POSITION: absolute; TOP: 256px "  onclick = " getvalue() "
None.gif                    type
= " button "  value = " Button " ></ FONT >
None.gif        
</ form >
None.gif    
</ body >
None.gif
</ HTML >
None.gif

转载于:https://www.cnblogs.com/owendu/archive/2006/11/13/559424.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值