RadioButton控制一列的TextBox禁用或者启用,如图:

swazn_yj swazn_yj 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
如图:


当一列上面的RadioButton按下后,其它列的TextBox禁用。
 <table width="90%" border="0" align="center" cellpadding="1">      
<tr>
<td class="auto-style6" style="text-decoration: underline">Cations</td>
<td class="auto-style3"><asp:RadioButton runat="server" ID="C_V1" Text="mg/L" GroupName="1" onClick="radionCheck(this)"></asp:RadioButton></td>
<td class="auto-style4"><asp:RadioButton runat="server" ID="C_V2" Text="ppmm CaCo3" GroupName="1" onClick="radionCheck(this)"></asp:RadioButton></td>
<td class="auto-style5"><asp:RadioButton runat="server" ID="C_V3" Text="meg/L" GroupName="1" onClick="radionCheck(this)"></asp:RadioButton></td>
<td width="672"><asp:RadioButton runat="server" ID="C_V4" Text="mmol/L" GroupName="1" onClick="radionCheck(this)"></asp:RadioButton></td>
</tr>
<tr>
<td align="right" class="auto-style6">Ammonium(NH4+)</td>
<td class="auto-style3">
<asp:TextBox ID="A_1" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4">
<asp:TextBox ID="B_1" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5">
<asp:TextBox ID="C_1" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td>
<asp:TextBox ID="D_1" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Potassium(K+)</td>
<td class="auto-style3">
<asp:TextBox ID="A_2" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_2" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_2" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_2" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Sodium(Na+)</td>
<td class="auto-style3">
<asp:TextBox ID="A_3" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_3" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_3" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_3" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Magnesium(Mg2+)</td>
<td class="auto-style3">
<asp:TextBox ID="A_4" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_4" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_4" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_4" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6" style="color: #FF0000">*Calcium(Ca2+)</td>
<td class="auto-style3">
<asp:TextBox ID="A_5" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_5" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_5" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_5" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Strontium(Sr2+)</td>
<td class="auto-style3">
<asp:TextBox ID="A_6" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_6" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_6" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_6" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Barium(Ba2+)</td>
<td class="auto-style3">
<asp:TextBox ID="A_7" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_7" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_7" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_7" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Fe +x</td>
<td class="auto-style3">
<asp:TextBox ID="A_8" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_8" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_8" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_8" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Mn +x</td>
<td class="auto-style3">
<asp:TextBox ID="A_9" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_9" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_9" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_9" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
<tr>
<td align="right" class="auto-style6">Al 3+</td>
<td class="auto-style3">
<asp:TextBox ID="A_10" runat="server" MaxLength="22" value="0.000"></asp:TextBox>
</td>
<td class="auto-style4"> <asp:TextBox ID="B_10" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td class="auto-style5"> <asp:TextBox ID="C_10" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
<td><asp:TextBox ID="D_10" runat="server" MaxLength="22" value="0.000"></asp:TextBox></td>
</tr>
</table>


<script type="text/javascript">
function radionCheck(radioID) {
if (document.getElementById("C_V1").checked == true) {
document.getElementById('A_1').disabled = false;
document.getElementById('B_1').disabled = true;
document.getElementById('C_1').disabled = true;
document.getElementById('D_1').disabled = true;
document.getElementById('B_2').disabled = true;
document.getElementById('C_2').disabled = true;
}
else if (document.getElementById("C_V2").checked == true) {

}
else if (document.getElementById("C_V3").checked == true) {

}
else (document.getElementById("C_V4").checked == true) {

}
}
</script>


我这样写有点笨了,哪位大神能帮忙修改的简单些?
...全文

相关推荐

评论 16
收藏 已收藏
分享
返回顶部
swazn_yj
JavaScript 87,984 成员 224,681 内容