stopPropagation, preventDefault 和 return false 的区别
<!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <title></title> </head> <body> <div id="dialog" style="background:#F00;">dialog</div> <script> document.getElementById('dialog').onclick = function(ev) { ev.stopPropagation() ev.cancelBubble = false } document.documentElement.onclick = function(ev) { document.getElementById('dialog').style.display = 'none' } </script> </body> </html>