javascript - Opera pass 单击重叠按钮

标签 javascript button opera

<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 中单击第一个按钮(<input>)时,按钮不会被按下,因为下一个

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

最佳答案

尝试在 div 上添加 z 索引

<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

关于javascript - Opera pass 单击重叠按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5612757/

相关文章:

javascript - 如何判断 IE8 窗口何时失去焦点?

android - 比较 ImageView 对象

Opera 12 的 CSS 特定规则?

javascript - 未捕获的类型错误 : Cannot read property 'url' of undefined - Google Image API

javascript - 如何更改 TOISOString 的日期格式?

javascript - Angular 4 - 使用 NG-IF 时出现 "Expression has changed after it was checked"错误

jquery - 如何在 jQuery Mobile 中制作圆形按钮?

javascript - 无法获取按钮的onclick属性来调用JS函数

javascript - Ziggeo、WebRTC 无法读取视频文件

css - 为什么 Opera 对齐伪元素不是在文本中心而是在元素中心?