<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title></title> </head> <body> <div style='background:red;width:200px;height:50px' onclick='a()'> <input type='button' value='ok' onclick='b(event)'></input> </div> <script type="text/javascript"> function a(e){ console.log("div") } function b(e){ console.log(e); if(e&&e.stopPropagation){ e.stopPropagation(); }else{ window.event.cancelBubble =true; } } </script> </body> </html>