javascript - 透明按钮无法在 Firefox 和 IE 中单击,但在 Chrome 和 Safari 中可以正常工作

标签 javascript html css internet-explorer google-chrome

我正在开发类似找不同游戏的东西,但我正在使用 Javascript 来进行找茬。

这里是:我有一些用 CSS 定位的透明按钮(css 样式背景透明),当我单击透明按钮时,会出现 Blob (使用 style.visibility)。问题是,此 javascript 在 Google Chrome 和 Safari 中都运行良好,但我不知道为什么这些按钮在 IE 和 Firefox 中不起作用。

你能帮我解决这个问题吗?我对这个问题感到困惑。谢谢!

最佳答案

这对我来说在所有浏览器中都很好


    css:
    button{
       display:block;
       width:500px;
       height:500px;
       background-color:transparent;
       border: 1px solid #000;
     }


    javascript:
    document.getElementById('but').onclick=function(){
        this.style.backgroundColor="#000"
    }

演示: http://jsfiddle.net/7tg3h/1/

关于javascript - 透明按钮无法在 Firefox 和 IE 中单击,但在 Chrome 和 Safari 中可以正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9020480/

相关文章:

javascript - 为什么我的递归函数没有返回最终结果?

javascript - 如何使用 'host-proof' 范例共享信息?

javascript - Ionic 选项卡 View 状态提供者空白 View

javascript - 单击按钮时从数组中交换图像

css - 在 webkit 中清除 float 的最简单方法是什么?

javascript - 使用 javascript 访问浏览器证书存储

html - 操作数字在有序列表中的位置

html - 背景图像显示图像的特定部分

javascript - window.location 之后如何存储数据?

javascript - 图像 slider 上的文字