手形光标在 Firefox 浏览器中不起作用
<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用于在鼠标悬停在标签上时获取鼠标光标。此处,“手形”和“帮助”光标在 Internet Explorer 中工作正常,但在 Firefox 和其他浏览器中无法工作。
<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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不需要
var Cursor
如果您可以像这样直接指定
help
或hand
,则,请检查工作示例 并查看 html 源代码
you don't need
var Cursor
if you can specifyhelp
orhand
directly like soand
please check working example and take a look at the html source code
更简单的版本,适用于“所有”浏览器:
Simpler version, works on 'all' browsers:
“手”在 Firefox 中不起作用。尝试“指针”。然而,“help”应该有效——尝试以比通过 JS 更直接的方式应用样式。
"Hand" does not work in Firefox. Try "pointer". "help", however, should work -- try applying the style in a more direct way than via JS.