首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

JS判断RadioButton是否选中,该如何处理

2012-03-17 
JS判断RadioButton是否选中asp:RadioButtonIDRadioYes runatserver Text同意 /br /asp:Radi

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()"/> 

热点排行