我知道这可能是一个简单的修复程序,但是我似乎无法在这里解决问题...
单击RadioButton1时,我试图禁用过去的文本框。
<asp:RadioButton ID="RadioButton1" runat="server" Checked="True" GroupName="DateTimeQuery" OnClick="javascript:TimeRangeClickEvent()"/>
<asp:TextBox ID="withinthepast" runat="server" Text="1"></asp:TextBox>
<script>
function TimeRangeClickEvent()
{
var radio1 = document.getElementById('<%=RadioButton1.ClientID%>').checked;
if (radio1 == true)
{
var within = document.getElementById('<%=withinthepast.ClientID%>').enabled = false;
}
}
</script>
有什么建议吗?
问题可能出在“启用”属性上。您可以尝试以下方法:
启用控件: ctl.removeAttribute("disabled")
禁用控件: ctl.setAttribute("disabled", "disabled")
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句