function ClearReply() {
     
        var Box = document.getElementById('ctl00_ContentPlaceHolder1_ReplyTextBox');
    
     
            Box.removeAttribute('disabled');
            Box.value = "";
          /* Box.disabled = "disabled"; 加了这句反而有问题*/
        
    }Box是一个文本输入框,一开始是可用的,里面有一些字符。我在一个按钮的click事件处理程序中调用ClearReply(),但是为什么执行Box.value = ""清空值后Box还是不可输入的呢??反而我在最后加一句代码:  Box.disabled = "disabled";之后,按下按钮Box的值不能置空了。请指教!~谢谢~~~~~~~

解决方案 »

  1.   

     Box.removeAttribute('disabled');你直接移除属性了
      

  2.   

     function ClearReply() {
         
            var Box = document.getElementById('ctl00_ContentPlaceHolder1_ReplyTextBox');
        
         
                Box.removeAttribute('disabled');//不要这句,这句意思是删除'disabled'属性
                Box.value = "";
              Box.disabled = "disabled"; 
            
        }
    你上面都删除了属性,下面属性都没了,怎么设置 Box.disabled = "disabled"; 
    呢?
      

  3.   

    楼主我测试下来没有问题
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>无标题页</title>
        <script>
            function tt(){
                var Box=document.getElementById("mytext");
               Box.removeAttribute('disabled');
             //  document.all.mytext.removeAttribute('disabled');
            }
        </script>
    </head>
    <body>
        <input id="mytext" type="text" disabled="disabled" value="2343434"  />
        <input id="Button1" type="button" value="button" onclick="tt()"/>
         <input id="Button2" type="button" value="disabled" onClick="javascript: document.all.mytext.disabled='false'"  />
    </body>
    </html>
      

  4.   

    另外js是无法通过id.disabled来设置disabled的属性的