asp.net里如何做到点选一个radiobutton后不刷新立即让某个指定的textbox从只读变成可写状态??
1个回答
2013-07-17
展开全部
<div>
<asp:RadioButtonList ID="radiobutton" runat="server">
<asp:ListItem onclick="ReadOnlys();" Value="1"></asp:ListItem>
<asp:ListItem onclick="ReadOnlys();" Value="2"></asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<script type="text/javascript">
function ReadOnlys()
{
document.getElementById("TextBox1").readOnly=true;
document.getElementById("TextBox2").readOnly=true;
if(document.getElementById("radiobutton_0").checked)
{
document.getElementById("TextBox1").readOnly=false;
}
if(document.getElementById("radiobutton_1").checked)
{
document.getElementById("TextBox2").readOnly=false;
}
}
ReadOnlys();
</script>
</div>
<asp:RadioButtonList ID="radiobutton" runat="server">
<asp:ListItem onclick="ReadOnlys();" Value="1"></asp:ListItem>
<asp:ListItem onclick="ReadOnlys();" Value="2"></asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<script type="text/javascript">
function ReadOnlys()
{
document.getElementById("TextBox1").readOnly=true;
document.getElementById("TextBox2").readOnly=true;
if(document.getElementById("radiobutton_0").checked)
{
document.getElementById("TextBox1").readOnly=false;
}
if(document.getElementById("radiobutton_1").checked)
{
document.getElementById("TextBox2").readOnly=false;
}
}
ReadOnlys();
</script>
</div>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询