下面得ff可以监听到  ie不能监听到
有没有什么奇淫办法能让ie监听到
<!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>
</head>
<body >
                   <input id="ccc"/>
                   <button onclick="document.getElementById('ccc').disabled='disabled'">disable</button>
                   <button onclick="document.getElementById('ccc').disabled=''">enable</button>
</body>
<script type="text/javascript">
         window.onload = function(){
                   var d = document;
                   ('watch' in d)&&d.getElementById('ccc').watch('disabled',function(){alert('变化')});
         };
</script>
</html>

解决方案 »

  1.   

    刚试了下 onpropertychange 勉强可以。
      

  2.   

    onpropertychange监听不到
    example
    <!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=utf-8" />
    <title></title>
    </head>
    <body >
       <input id="ccc"/>
       <button onclick="document.getElementById('ccc').disabled='disabled'">disable</button>
       <button onclick="document.getElementById('ccc').disabled=''">enable</button>
    </body>
    <script type="text/javascript">
     window.onload = function(){
       var d = document;
    f('watch' in d){
    d.getElementById('ccc').watch('disabled',function(){alert('变化')});
    }else{
    d.getElementById('ccc').onpropertychange =function(){
    if(this.disabled =='disabled')alert('变化');
    }
    }
     };
    </script>
    </html>
      

  3.   

    只有当属性改变时才触发。如果当前就是disable状态,那么也不会alert("变化");
    当前able时,再更改为diable就触发了。
    他只监听改变,所以比较悲剧啊。
      

  4.   

    IE中,disabled为真时屏蔽所有事件,很不幸,onpropertychange就在其中用setTimeOut倒是可以监听,但是存在响应速度问题
      

  5.   


    <!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>
    </head>
    <body >
       <input id="ccc"/>
       <button id="btn">disable</button>
    </body>
    <script type="text/javascript">
             window.onload = function(){
                       var d = document;
       if (d.watch) {
    d.getElementById('ccc').watch('disabled',function(){alert('变化')});
    return;
       } else {
    window.attachEvent('onmessage', function(msg) {
    alert(msg.data);
    });
       }
       
             };
     document.getElementById('btn').onclick = function() {
    document.getElementById('ccc').disabled='disabled';
    if (window.postMessage) {  
    window.postMessage('disable变化', '*');
    }

     }
    </script>
    </html>
    在IE8下测试 IE6 7也是有办法hack的 但如果想找专门属性 那应该没有
      

  6.   

    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">  <script language="javascript">
          function test()
      {
              if(event.propertyName=="checked"&&event.srcElement.checked)
      {
                 alert("=====kkkkkk");
      }
      }
      </script>
     </HEAD> <BODY>
         <input type="checkbox" name="box" id="box" onpropertychange="test()"/>
     </BODY>
    </HTML>