js Event 特别注意的事件

    xiaoxiao2021-03-25  80

    1,使用IE 的 attachEvent 方法注册事件响应程序时,事件处理程序的this值是window。但使用DOM0级的事件注册程序时,this是注册事件的元素。

    2,在非IE浏览器中,事件处理程序中的this等于currentTarget

    3,在IE浏览器中,this等于event.srcElement

    4,IE中的target对象和非IE对象中的target

                                              IE                                                                   非IE

    event对象               window.event                                                       event

    target对象               event.target                                                          event.srcElement

    阻止冒泡                 cancelbubble =true                                            event.stopPropagation()

    阻止默认行为        returnValue = true                                                prventDefault()

    5,焦点事件:blur,focus,focusin,focusout  blu和focus不会冒泡

    6,鼠标事件:click、dbclick,mouseenter,mouseleave,mousemove,mouseout。  mouseenter、mouseleave不会冒泡。

    转载请注明原文地址: https://ju.6miu.com/read-37185.html

    最新回复(0)