帮助Cursor在firefox浏览器中不起作用

时间:2009-11-08 07:55:17

标签: javascript html firefox pointers cursor

<html>

<head>
<title>Question</title>
<script type="text/javascript" >
function MouseOverHand(ID)
{
var Cursor='hand';
var ID=ID;
if (!document.all){ Cursor='pointer'; }
document.getElementById(ID).style.cursor=Cursor;        
}
</script>
<script type="text/javascript" >
function MouseOverHelp(ID)
{
var Cursor='help';
var ID=ID;
if (!document.all){ Cursor='pointer'; }
document.getElementById(ID).style.cursor=Cursor;        
}
</script>
</head>

<body>
<label id="Hand" onmouseover="MouseOverHand('Hand');" > Hand </label><br/><br/>
<label id="Help" onmouseover="MouseOverHelp('Help');" > Help </label>
</body>

</html>

在上面的html用于将鼠标光标移到标签的鼠标上方。这里的“手”和“帮助”光标在互联网浏览中工作正常,但它不能在Firefox和其他浏览器中工作

希望得到您的支持,

3 个答案:

答案 0 :(得分:1)

更简单的版本适用于'所有'浏览器:

<script type="text/javascript" >
function MouseOverPointer(obj) //obj is the triggering element
{
    if(obj.id=='Help')
        obj.style.cursor = "help";
    else if(obj.id=='Hand')
        obj.style.cursor = "pointer";
}
</script>

<label id="Hand" onmouseover="MouseOverPointer(this);" > Hand </label><br/><br/>
<label id="Help" onmouseover="MouseOverPointer(this);" > Help </label>

答案 1 :(得分:1)

如果您可以直接指定var Cursorhelp,则不需要hand

document.getElementById(ID).style.cursor='hand';        

document.getElementById(ID).style.cursor='help';        

请检查working example并查看html源代码

答案 2 :(得分:1)

“手”在Firefox中不起作用。试试“pointer”。然而,“帮助”应该起作用 - 尝试以比JS更直接的方式应用样式。