<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
<style type="text/css">
div{background: #ccc;}
</style>
</head>
<body>
    <div onclick="alert('点到div了')">
        <a href="#">aaa</a>
    </div>
<script type="text/javascript">
    document.getElementsByTagName('a')[0].onclick=function(e){
        alert(1);
        _stop.stopDef(e); //阻止默认事件
        _stop.stopBubble(e); //阻止事件冒泡
    }    

    if(typeof(_stop)=='undefined'&&!_stop){
        var _stop={
            //阻止默认事件
            stopDef:function(e){
                var e = e || event;
                if(e.preventDefault) e.preventDefault();    //非IE
                    else e.returnValue = false;    //IE
            },
            //阻止事件冒泡
            stopBubble:function(e){
                var e = e || event;
                if(e.stopPropagation) e.stopPropagation();    //非IE
                    else e.cancelBubble = true;    //IE
            }
        }
    }
</script>
</body>
</html>