【问题标题】:onclick the child, avoid the parent functiononclick 子,避免父函数
【发布时间】:2010-09-04 17:48:14
【问题描述】:

我有一个div,它有一个点击事件。在div 中有两个链接可用于单独的点击事件。

我的问题是,当我单击两个单独的链接时,div 事件只触发而不是链接事件。如何分别使用这三个事件?

有人帮忙吗?

【问题讨论】:

    标签: javascript html parent-child


    【解决方案1】:

    google cancelBubble 和 cancelPropogation(做同样事情但 Firefox 和 ie 需要的不同方法)

    另见:

    Prevent parent container click event from firing when hyperlink clicked

    Two differents OnClick on two divs, one over the other

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-10-12
      • 2017-10-09
      • 2016-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-15
      • 2023-04-03
      相关资源
      最近更新 更多