We all know IE is weird:
<input id="mytestinput" onclick="this.style.backgroundImage='url(http://blog.youkuaiyun.com/images/authorship.gif)';" type="button" value="change background image" />
<script>
document.getElementById('mytestinput').attachEvent(
'onpropertychange', function () { alert(event.propertyName); });
</script>
click the button will alert twice.
If u set backgroundImage to 'none', it will also alert twice, however, set to ''(empty string), will only once...

本文探讨了在Internet Explorer浏览器中,通过JavaScript设置元素背景图片属性时触发'onpropertychange'事件的现象。发现当设置背景图片URL为具体路径或设为'none'时会触发两次事件,而设置为空字符串时仅触发一次。
580

被折叠的 条评论
为什么被折叠?



