<div id="a" onclick="test()" style="background: red;width:100px;height:100px;">
<div id="b">
</div>
<div id="c">
</div>
</div>
<script>
function test(){
    alert('成功');
}
 </script>

解决方案 »

  1.   

    你需要采用JS中爆破的方法终止其他DIV点击事件。
      

  2.   


    <div id="a" onclick="test()" style="background: red;width:100px;height:100px;">
    <div id="b" onclick="test1(event)"  style="background: blue;width:50px;height:50px;">B
    </div>
    <div id="c" onclick="test2()"  style="background: green;width:50px;height:50px;">
    </div>
    </div>
    <script>
    function test(){
        alert('div A 被点击了')
        
    }
    function test1(e) {
        alert('div B 被点击了 但事件不会传播到A')
        e.stopPropagation();  
    }
    function test2() {
        alert('div c 被点击了 但事件会传播到A')
    }
     </script>