【问题标题】:Firefox css cursor property in anchor tag锚标记中的 Firefox css 光标属性
【发布时间】:2012-07-15 21:48:56
【问题描述】:

在 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>

【问题讨论】:

    标签: javascript html css firefox cursor


    【解决方案1】:

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

    Auto 告诉浏览器做它通常会做的任何事情 情况。这就像您的光标的“重置为默认值”选项。

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

    【讨论】:

      【解决方案2】:

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

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

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

      【讨论】:

        【解决方案3】:

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

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

        当我尝试它时它在 Firefox 中工作,据我所知,它也应该在其他浏览器中工作。不过试试看,以防我错了。

        如果这不是您想要的,您可以在http://www.w3schools.com/CSS/pr_class_cursor.asp 找到更多的指针属性值。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2016-10-11
          • 1970-01-01
          • 2012-02-10
          • 2012-06-08
          • 2018-08-25
          相关资源
          最近更新 更多