views:

123

answers:

4

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

lnrbob
A: 

OK... it is interesting .. I tried it and It make exactly what you say... Maybe it is bug... coding is ok

jatt
+1  A: 

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.

Marwelln
A: 

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.

matsolof