Search code examples
javascripthtmlfirefoxmouse-cursor

Hand Cursor is not working in the firefox browser


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

The above html is used to take mouse cursor in the mouse over of labels. Here, "Hand" and "help" cursor is working fine in Internet Explorer, but it's not working in Firefox and other browsers.


Solution

  • you don't need var Cursor if you can specify help or hand directly like so

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

    and

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

    please check working example and take a look at the html source code