现在的位置: 首页 > 综合 > 正文

onpropertychange事件

2012年09月15日 ⁄ 综合 ⁄ 共 708字 ⁄ 字号 评论关闭

onpropertychange事件


      IE下,当一个HTML元素的属性改变的时候,都能通过 onpropertychange来捕获。例如一个 <input name="text1" id="text1" />对象的value属性被页面的脚本修改的时候,onchange无法捕获到,而onpropertychange却能够捕获。
也就是说:onpropertychange能及时捕获属性值的变化,而onchange在属性值改变时还必须使得当前元素失去焦点(onblur)才可以激活该事件!onpropertychange事件只能在IE下使用

      举例:1.<input type="text" onpropertychange='alert("change")' />,每输入一个字符都会激活onpropertychange事件。



      IE下,当一个HTML元素的属性改变的时候,都能通过 onpropertychange来捕获。例如一个 <input name="text1" id="text1" />对象的value属性被页面的脚本修改的时候,onchange无法捕获到,而onpropertychange却能够捕获。
也就是说:onpropertychange能及时捕获属性值的变化,而onchange在属性值改变时还必须使得当前元素失去焦点(onblur)才可以激活该事件!onpropertychange事件只能在IE下使用

      举例:1.<input type="text" onpropertychange='alert("change")' />,每输入一个字符都会激活onpropertychange事件。



抱歉!评论已关闭.