开发者

Firefox css cursor property in anchor tag

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_pointe开发者_如何转开发r();" value="Cursor Pointer">
</body>
</html>


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜