We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
答案:
1.事件流的区别
IE 采用冒泡型事件 Netscape 使用捕获型事件 DOM 使用先捕获后冒泡型事件 示例:
复制代码代码如下:
<body> <div> <button>点击这里</button> </div> </body>
冒泡型事件模型: button->div->body (IE 事件流)
捕获型事件模型: body->div->button (Netscape 事件流)
DOM 事件模型: body->div->button->button->div->body (先捕获后冒泡)
2.事件侦听函数的区别
IE 使用:
[Object].attachEvent("name_of_event_handler", fnHandler); //绑定函数 [Object].detachEvent("name_of_event_handler", fnHandler); //移除绑定
DOM 使用:
[Object].addEventListener("name_of_event", fnHandler, bCapture); //绑定函数 [Object].removeEventListener("name_of_event", fnHandler, bCapture); //移除绑定
bCapture 参数用于设置事件绑定的阶段,true 为捕获阶段,false 为冒泡阶段。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
答案:
1.事件流的区别
IE 采用冒泡型事件 Netscape 使用捕获型事件 DOM 使用先捕获后冒泡型事件
示例:
复制代码代码如下:
冒泡型事件模型: button->div->body (IE 事件流)
捕获型事件模型: body->div->button (Netscape 事件流)
DOM 事件模型: body->div->button->button->div->body (先捕获后冒泡)
2.事件侦听函数的区别
IE 使用:
DOM 使用:
bCapture 参数用于设置事件绑定的阶段,true 为捕获阶段,false 为冒泡阶段。
The text was updated successfully, but these errors were encountered: