下面得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>
有没有什么奇淫办法能让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>
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>
当前able时,再更改为diable就触发了。
他只监听改变,所以比较悲剧啊。
<!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的 但如果想找专门属性 那应该没有
<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>