锚标记中的 Firefox CSS 光标属性

发布于 2024-09-24 08:56:18 字数 739 浏览 6 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

垂暮老矣 2024-10-01 08:56:18

http://webdesign.about.com/od/styleproperties/a/aa060607。嗯

自动告诉浏览器执行它通常会执行的操作
情况。这就像光标的“重置为默认值”选项。

据此,Firefox 没有 pointer 作为默认光标...或类似的东西。

http://webdesign.about.com/od/styleproperties/a/aa060607.htm

Auto tells the browser to do whatever it would normally do in this
situation. It's like a "reset to defaults" option for your cursor.

According to that, Firefox doesn't have pointer as default cursor... or something like that.

此岸叶落 2024-10-01 08:56:18

不要认为这是您的代码的问题 - 可能是 FF 错误。这也不能正常工作(不涉及js):

<a href="http://example.com" id="anchor" style="cursor:auto">Example</a>

忘记了解决方法。最好用一个按钮添加一个类,然后用另一个按钮删除它。这样您就不会得到混乱的内联样式,并且可以轻松恢复为默认值。

Don't think it is a problem with your code - might be an FF bug. This doesn't work properly either (no js involved):

<a href="http://example.com" id="anchor" style="cursor:auto">Example</a>

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.

追风人 2024-10-01 08:56:18

您希望指针看起来像一个稍微倾斜的向上箭头吗?如果是这样,请尝试以下代码:

<a href="http://example.com" id="anchor" style="cursor:default">Example</a>

当我尝试它时,它在 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:

<a href="http://example.com" id="anchor" style="cursor:default">Example</a>

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文