日期:2014-05-18  浏览次数:20400 次

JS判断RadioButton是否选中
<asp:RadioButton ID="RadioYes" runat="server" Text="同意" />
  <br />
  <asp:RadioButton ID="RadioNo" runat="server" Text="不同意"/>
判断这俩个第一个选中
  <asp:Button ID="BtnUpLoad" runat="server" Text="上传" onclick="BtnUpLoad_Click" 
  Enabled="False" />
的Enabled为true 第二个选中Enabled为false

------解决方案--------------------
HTML code

<script type="text/javascript">
    function is()
    {
    if(document.getElementById("RadioYes").checked==true)
    {
    alert("YES");
    document.getElementById('BtnUpLoad').disabled=document.getElementById('RadioYes').checked; 
    }
    else if(document.getElementById("RadioNo").checked==true)
    {
    alert("NO");
    document.getElementById('BtnUpLoad').disabled=document.getElementById('RadioYes').checked;
    }
    }
    </script>

<asp:RadioButton  ID="RadioYes" runat="server" Text="同意" onclick="is()" /> 
                              <br /> 
                            <asp:RadioButton  ID="RadioNo" runat="server" Text="不同意" onclick="is()"/>