【问题标题】:Opera pass click to overlaped buttonOpera 通过点击重叠按钮
【发布时间】:2011-04-10 15:27:59
【问题描述】:
<div style="width: 100px; height: 25px; position: relative;">
    <input type="button" style="width: 100px; height: 25px;" onclick="alert(1);" value="Input"/>
    <div style="top: 0px; left: 0px; bottom: 0px; right: 0px; position: absolute; background-color: #000000; opacity: 0.3;"></div>
</div>
<br/>
<div style="width: 100px; height: 25px; position: relative;">
    <button style="width: 100px; height: 25px;" onclick="alert(1);">Button</button>
    <div style="top: 0px; left: 0px; bottom: 0px; right: 0px; position: absolute; background-color: #000000; opacity: 0.3;"></div>
</div>

当我在 Opera 11.01 中单击第一个按钮 () 时,没有按下按钮,因为下一个

重叠。但是,如果我单击第二个按钮(

【问题讨论】:

  • 在 Chrome 12 Dev 上,我没有收到任何 alert() 消息。

标签: javascript button opera


【解决方案1】:

尝试在 div 上添加 z-index

<div style="width: 100px; height: 25px; position: relative;">
    <button style="width: 100px; height: 25px;" onclick="alert(1);">Inpute</button>
    <div style="top: 0px; left: 0px; bottom: 0px; right: 0px; position: absolute; background-color: #000000; opacity: 0.3; z-indeX: -1;"></div>
</div>
<br/>
<div style="width: 100px; height: 25px; position: relative;">
    <button style="width: 100px; height: 25px;" onclick="alert(1);">Button</button>
    <div style="top: 0px; left: 0px; bottom: 0px; right: 0px; position: absolute; background-color: #000000; opacity: 0.3; z-index: -1;"></div>
</div>

更新:JsFiddle

【讨论】:

  • 不,问题不是我不能按下按钮。有 div 与按钮重叠。我不能按按钮一定是按钮结束了。我的解决方案适用于 Firefox 和 Chrome,但不适用于 Opera。在 Opera 中,第二个按钮被按下,尽管它与 div 重叠 - 这是有问题的。我不想在 Opera 中按下第二个按钮
  • 您的解决方案在 IE9 中也不起作用,如果您只是想禁用按钮,为什么不直接在按钮上添加“禁用”属性?
  • 解决方案应该可以在 firefox、chrome 和 opera 中运行。 IE 被忽略。属性“已禁用”不能解决此任务。如果我使用 而不是
猜你喜欢
  • 2018-07-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-03-20
  • 1970-01-01
  • 2018-03-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多