遍历:
var ck = document.getElementsByTagName("input");
for (var i=0;i<ck.length;i++)
{
if(ck[i].type=="radio")
{
if(ck[i].checked)
{
flag=false;
}
}
}

解决方案 »

  1.   

    <%@ Page language="c#" Codebehind="WebForm6.aspx.cs" AutoEventWireup="false" Inherits="test.WebForm6" trace=false%>
    <%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
    <HTML>
    <HEAD>
    <title>WebForm6</title>
    <META content="Microsoft Visual Studio 7.0" 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" id="clientEventHandlersJS">
    <!--function btn1_onclick() 
    {
    for(i=0;i<<%= RadioButtonList1.Items.Count%>;i++)
    {
    obj = eval("document.forms[0].RadioButtonList1_"+i);
    if(obj.checked == true)
    {
    alert(obj.value);
    }
    }
    }//-->
    </SCRIPT>
    </HEAD>
    <BODY MS_POSITIONING="GridLayout">
    <FORM id="WebForm6" method="post" runat="server">
    <FONT face="宋体">
    <asp:RadioButtonList id="RadioButtonList1" style="Z-INDEX: 101; LEFT: 67px; POSITION: absolute; TOP: 63px" runat="server" Width="111px">
    <asp:ListItem Value="1" Selected="True">1</asp:ListItem>
    <asp:ListItem Value="2">2</asp:ListItem>
    <asp:ListItem Value="3">3</asp:ListItem>
    <asp:ListItem Value="4">4</asp:ListItem>
    </asp:RadioButtonList>
    <INPUT id="btn1" style="Z-INDEX: 102; LEFT: 99px; POSITION: absolute; TOP: 264px" type="button" value="Button" language="javascript" onclick="return btn1_onclick()"></FONT></FORM>
    </BODY>
    </HTML>
      

  2.   

    to chnking(kent) :
    对你上面的 for(i=0;i<<%= RadioButtonList1.Items.Count%>;i++) 
    如果在.js 中,使用document.Form1.RadioButtonList1会出错,怎么修正呢?
    很急的,现行谢了。