比如有1个TEXTBOX1,和一组RadioButton,当我TextBox1里输入为"1"时,RadioButton为可用,不填或者其他值时为不可用,请问怎么实现?  JS吗?

解决方案 »

  1.   

    TextBox1中onpropertychange="setRadioButtonDisplay()"function setRadioButtonDisplay()
    {
        document.getElementById('<%=RaidoButton1.ClientID %>').disabled = false;
    }
      

  2.   


    <script type="text/javascript">
            function textChange(obj) {        
                var a = document.getElementById("RadioButton1");
                if (event.keyCode == 49) {                
                    a.setAttribute("disabled", "disabled");
                }
                else {
                    a.removeAttribute("disabled");
                }
            }
    </script><asp:TextBox ID="TextBox1" runat="server" onkeypress="textChange(this)"></asp:TextBox>
    <asp:RadioButton ID="RadioButton1" runat="server" Text="RadioButton1"/>
      

  3.   

    反了   ......event.keyCode != 49
      

  4.   

    <asp:TextBox ID="TextBox1" runat="server" onkeypress="textChange(this)"></asp:TextBox>
    <asp:RadioButton ID="RadioButton1" runat="server" Text="RadioButton1"/>
    <script type="text/javascript">
            function textChange(obj) {        
                var a = document.getElementById("RadioButton1");
                if (event.keyCode !=49) {                
                    a.setAttribute("disabled", "disabled");
                }
                else {
                    a.removeAttribute("disabled");
                }
            }
    </script>
      

  5.   


    那事件就要用onchange了,然后
    var b=.getElementById("TextBox1");
    if(b.value=="哈哈")
    {
        ......
    }