0
<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は、ラベルの上にマウスカーソルを置くために使用されます。ここで、「Hand」カーソルと「help」カーソルはInternet Explorerでは正常に機能していますが、Firefoxやその他のブラウザでは機能していません。

4

3 に答える 3

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>
于 2009-11-08T08:02:20.440 に答える
1

var Cursorあなたがそう指定することができるか、直接好きであるならば、あなたhelphand必要ありません

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

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

実例を確認し、htmlソースコードを見てください

于 2009-11-08T08:02:39.267 に答える
1

「手」はFirefoxでは機能しません。「ポインタ」を試してください。ただし、「ヘルプ」は機能するはずです。JSを介するよりも直接的な方法でスタイルを適用してみてください。

于 2009-11-08T08:05:49.310 に答える