javascript - anchor 标记上的 onclick 事件在 IE 中有效,但在 Firefox 和 Chrome 中无效

标签 javascript internet-explorer firefox google-chrome onclick

这是 HTML 代码的相关部分:

感兴趣

警报选择值并在 IE 中运行时显示,但在 Chrome 和 Firefox 中显示未定义。

有什么想法吗?

最佳答案

一些事情:

1) 标签中的额外空格。 < a>应该是 <a> .

2) 在您的 onclick 中额外引用属性。应该是onclick="alert(this.value);" .

3) value不是 anchor 元素的有效属性。

关于javascript - anchor 标记上的 onclick 事件在 IE 中有效,但在 Firefox 和 Chrome 中无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11484795/

相关文章:

javascript - 从谷歌存储桶读取图像并使用锐利转换失败

javascript - 无法访问关于 :blank iframe in IE after the document. 的域更改

javascript - 为什么这个动画在 FireFox 中这么慢?

javascript - 如何删除 flex 盒模型中 flex 元素之间的空格

javascript - 如何在使用 Firefox 时跟踪 JS?

php - 如何通过单击按钮从服务器下载文件

html - IE6 : How to get inline base64 images to work with IE6?

html - 如何使输入元素文本溢出:ellipsis on IE?

javascript - 显示和隐藏 div 的 JavaScript 在 IE 中有效,但在 Firefox 或 Chrome 中无效

html - DIV 在 Chrome 和 Firefox 中不显示