锚标记中的 Firefox CSS 光标属性
在 Firefox 3.6.10 和 3.6.7 中,当页面首次加载并且鼠标指针位于链接上方时,它会变成一只手。但是,当我通过 javascript 将锚标记光标样式设置为自动并将鼠标指针悬停在同一锚标记上时,现在它显示为纯文本。在 IE8 和 Chrome 中,它按预期工作(我)。
难道是我理解错了?
<html lang="en">
<head>
<script type="text/javascript">
function cursor_auto() {
document.getElementById('anchor').style.cursor = 'auto';
}
function cursor_pointer() {
document.getElementById('anchor').style.cursor = 'pointer';
}
</script>
</head>
<body>
<a href="http://example.com" id="anchor">Example</a>
<input type="button" onclick="cursor_auto();" value="Cursor Auto">
<input type="button" onclick="cursor_pointer();" value="Cursor Pointer">
</body>
</html>
In Firefox 3.6.10 and 3.6.7 when a page is first loaded and the mouse pointer is over a link it turns into a hand. But when I set the anchor tag cursor style to auto by javascript and hover the mouse pointer over that same anchor tag now it shows as it was over pure text. In IE8 and Chrome it works as expected (by me).
Do I understand it wrong?
<html lang="en">
<head>
<script type="text/javascript">
function cursor_auto() {
document.getElementById('anchor').style.cursor = 'auto';
}
function cursor_pointer() {
document.getElementById('anchor').style.cursor = 'pointer';
}
</script>
</head>
<body>
<a href="http://example.com" id="anchor">Example</a>
<input type="button" onclick="cursor_auto();" value="Cursor Auto">
<input type="button" onclick="cursor_pointer();" value="Cursor Pointer">
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
http://webdesign.about.com/od/styleproperties/a/aa060607。嗯
据此,Firefox 没有
pointer
作为默认光标...或类似的东西。http://webdesign.about.com/od/styleproperties/a/aa060607.htm
According to that, Firefox doesn't have
pointer
as default cursor... or something like that.不要认为这是您的代码的问题 - 可能是 FF 错误。这也不能正常工作(不涉及js):
忘记了解决方法。最好用一个按钮添加一个类,然后用另一个按钮删除它。这样您就不会得到混乱的内联样式,并且可以轻松恢复为默认值。
Don't think it is a problem with your code - might be an FF bug. This doesn't work properly either (no js involved):
Forgot the workaround. It would be better to add a class with one button and remove it with another. This way you don't end up with messy inline styles and you can revert to defaults easily.
您希望指针看起来像一个稍微倾斜的向上箭头吗?如果是这样,请尝试以下代码:
当我尝试它时,它在 Firefox 中工作,据我所知,它也应该在其他浏览器中工作。不过,请尝试一下,以防我错了。
如果这不是您想要的,您可以在 http://www 找到更多指针属性值.w3schools.com/CSS/pr_class_cursor.asp。
Do you want the pointer to look like a slightly tilted arrow pointing upwards? If so, try this code:
It worked in Firefox when I tried it and should as far as I know work in other browsers as well. Try it out, though, in case I'm wrong.
If this isn't what you want, you can find more property values for pointers at http://www.w3schools.com/CSS/pr_class_cursor.asp.