Firefox css光标属性在锚标记
问题描述:
在Firefox 3.6.10和3.6.7中,当第一次加载页面并且鼠标指针位于链接上时,它变成了一只手。但是,当我通过JavaScript将锚标记光标样式设置为auto时,并将鼠标指针悬停在同一个锚标记上时,它会显示为它是纯文本。在IE8和Chrome中,它按预期工作(由我)。Firefox css光标属性在锚标记
我理解错了吗?
<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>
答
不要认为这是你的代码有问题 - 可能是FF错误。这也无法正常工作(不涉及js):
<a href="http://example.com" id="anchor" style="cursor:auto">Example</a>
忘了解决方法。最好用一个按钮添加一个类,并用另一个按钮删除它。这样,您不会以混乱的内联样式结束,并且可以轻松地恢复为默认值。
答
http://webdesign.about.com/od/styleproperties/a/aa060607.htm
自动告诉浏览器做任何它通常会在这种情况 做。这就像你的光标“重置为默认值”选项。
据此,Firefox没有pointer
作为默认光标......或类似的东西。
答
你想让指针看起来像一个稍微向上倾斜的箭头吗?如果是的话,试试这个代码:
<a href="http://example.com" id="anchor" style="cursor:default">Example</a>
它的工作在Firefox中,当我试了一下,应该在其他浏览器,据我了解正常工作。尽管如此,以防万一我错了。
如果这不是您想要的,您可以在http://www.w3schools.com/CSS/pr_class_cursor.asp找到指针的更多属性值。