onclick 阻止 冒泡 栏目 应用数学 繁體版
原文   原文链接

 

<!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>
相关文章
相关标签/搜索
每日一句
    每一个你不满意的现在,都有一个你没有努力的曾经。
本站公众号
   欢迎关注本站公众号,获取更多信息