JS——事件冒泡(1)
来源:互联网 发布:淘宝商城怎么开店 编辑:程序博客网 时间:2024/06/06 18:12
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title><style>#d1 {width: 200px;height: 200px;background: blue;}#d2 {width: 150px;height: 150px;background: green;}#d3 {width: 100px;height: 100px;background: red;}</style></head><body><div id="d1"><div id="d2"><div id="d3"></div></div></div><script>d1.onclick = function() {alert(this.id);}d2.onclick = function() {alert(this.id);}d3.onclick = function() {alert(this.id);}</script></body></html>
--------------------------------------------------------------------------
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Document</title><style>#d1 {width: 200px;height: 200px;background: blue;}#d2 {width: 150px;height: 150px;background: green;}#d3 {width: 100px;height: 100px;background: red;}</style></head><body><div id="d1"><div id="d2"><div id="d3"></div></div></div><script>//事件冒泡 d1.onclick = function(e) {alert(this.id);e.stopPropagation();}d2.onclick = function(e) {alert(this.id);e.stopPropagation();}d3.onclick = function(e) {alert(this.id);e.stopPropagation();}</script></body></html>
阅读全文
0 0
- JS——事件冒泡(1)
- JS事件冒泡(阻止)
- JS事件冒泡(阻止)
- 事件(1)——事件冒泡与捕获
- JS事件——禁止事件冒泡和禁止默认事件
- JS事件流(事件冒泡和事件捕获)
- 什么是JS事件冒泡?(网络)
- js委托事件-addEventListeners(冒泡方向)
- 什么是JS事件冒泡?(网络)
- JS中的事件冒泡
- Js 冒泡事件阻止
- js取消事件冒泡
- JS冒泡事件解决方案
- 阻止js事件冒泡
- JS冒泡事件解决方案
- JS 事件冒泡
- js事件冒泡
- JS阻止事件冒泡
- 数据库连接池
- [Java数据结构]简单排序之插入排序
- 用java计算一个目录里所有文件的大小
- HDU 5916
- 代码重构之Spring+工厂+策略模式
- JS——事件冒泡(1)
- c++中的处理类型的三种方式
- 爬虫实战:基于 HtmlParser 实现网页链接的提取
- matlab中num2str
- qt编译caffe遇到的opencv版本问题
- JAVA_String之trim()源码
- 【操作系统】死锁
- Java小面试题(4)
- PHP留言板提供功能