<script language="javascript" type="text/javascript">
       function Check()
      {
         var a=document.getElementById("txtIsAwardContract" );
         if(a.value=="是")
             document.getElementById('txtRevisionFee').disabled=true;
     }   
     
    </script>    <asp:TextBox ID="txtIsAwardContract" runat="server"></asp:TextBox>
        <asp:TextBox ID="txtRevisionFee" runat="server"   ></asp:TextBox>
        <asp:Button ID="Button1" runat="server" OnClientClick="Check()" Text="测试" />代码是在文本框里输入“是”的时候,后面一个文本框就不可用。可是怎么都实现不了。问题是。当我把最后一段代码document.getElementById('txtRevisionFee').disabled=true;中的'txtRevisionFee'改成'Button1'就可以实现按钮不可用了。

解决方案 »

  1.   

    不会用asp。又没有编译生成之后的html页面发一个看看
      

  2.   

    文件 本框 没有不可用状态
    document.getElementById('txtRevisionFee').readOnly="readOnly";
      

  3.   

    谁告诉你的!试试<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
     <script language="javascript" type="text/javascript">
           function Check()
          {
             var a=document.getElementById('a' );
             if(a.value=="是") document.getElementById('b').disabled=true;
         }   
         
        </script></head><body>
    <input type="text" id="a" disabled="true" name="a" />
    <input type="text" id="b" name="b" />
    <input type="button" onclick="Check()" value="click" />
    </body>
    </html>
      

  4.   

    http://www.w3.org/TR/html401/interact/forms.html#adef-disabled
    The following elements support the disabled attribute: BUTTON, INPUT, OPTGROUP, OPTION, SELECT, and TEXTAREA.
      

  5.   

    哈哈!我上面的也点问题!disabled="disabled"才能通过w3c的validate
      

  6.   


           function Check()
          {
             var a=document.getElementById('a' );
             if(a.value=="是"){
      document.f.b.disabled=true;
      alert(document.getElementById('b').getAttribute('disabled'));
      }
         }   
         
        </script>opera 10. output:true
    ie 8. output:DISABLED
    ff 3.5 output: 空
    ie6. 
    sorry!我的MultipleIEs好象出了点问题ie6测不出来
      

  7.   

    呵呵。。问题解决了OnClientClick中要写成return Check()。。感谢各位的帮助