前台代码如下:
<asp:RadioButton ID="RadioTrue" Text="通过" runat="server" GroupName="RadioCheck" />
<asp:RadioButton ID="RadioFalse" Text="未通过" runat="server" GroupName="RadioCheck"/>
<input type="text" runat="server" name="txtReason" id="txtReason" style="display:none" />我想实现的是选中未通过的RadioButton控件旁边默认隐藏的TextBox控件就马上显示出来。
求JS代码。 谢谢各位大神了~
<asp:RadioButton ID="RadioTrue" Text="通过" runat="server" GroupName="RadioCheck" />
<asp:RadioButton ID="RadioFalse" Text="未通过" runat="server" GroupName="RadioCheck"/>
<input type="text" runat="server" name="txtReason" id="txtReason" style="display:none" />我想实现的是选中未通过的RadioButton控件旁边默认隐藏的TextBox控件就马上显示出来。
求JS代码。 谢谢各位大神了~
<input type="radio" value="未通过" name="RadioCheck" id="RadioFalse" onclick="show()" />未通过<input type="text" runat="server" name="txtReason" id="txtReason" style="display:none" />
function show(){
var b=document.getElementById("RadioFalse");
if(b.checked)
{
document.getElementById("txtReason").style.display="block";
}
else
{
document.getElementById("txtReason").style.display="none";
}
}
<%=RadioFalse.ClientID%> (可以用JS)