首页 > 代码库 > 事件冒泡案例

事件冒泡案例

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html onclick="alert(‘html‘);" xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>事件冒泡案例</title></head><body onclick="alert(‘body‘);"><div style="width:300px; height:300px; background:red;" onclick="alert(this.style.background);">    <div style="width:200px; height:200px; background:green;" onclick="alert(this.style.background);">        <div style="width:100px; height:100px; background:#CCC;" onclick="alert(this.style.background);">        </div>    </div></div></body></html>

 

事件冒泡案例