【发布时间】:2016-05-06 10:35:14
【问题描述】:
我在 Chrome 中遇到了鼠标悬停/鼠标移动事件的问题 - 版本 50.0.2661.94 m。在 Mozilla 中同样可以正常工作。
要求:鼠标悬停在下拉菜单(选项标签)上,我需要显示每个选项的描述。
代码:
HTML:
<td>
<select class="div_taskDesc" name="selectedindexid'+rowcounter+'" OnChange="SetDF(\''+rowcounter+'\');" onmousemove="getOptionDesc(this,event);"><?echo $Options_select;?>
</select>
</td>
JavaScript:
function getOptionDesc(o, e) {
var selected=o.options[o.selectedIndex].text;
var selecteddesc=o.options[o.selectedIndex].label;
var x = e.clientX;
var y = e.clientY;
var coor = "Coordinates: (" + x + "," + y + ")";
console.log(coor);
if (selected!=""){
//Code to display description
}
else{
//code to hide description
}
}
【问题讨论】:
-
首先,您能否通过在每行前面将代码缩进 4 个空格来更新您的问题,以便阅读?那么,如何触发这个功能呢?也添加这部分...因为问题可能就在那里。
-
在 onmousemove="getOptionDesc(this,event);" 中调用它选择标签...及其在其他浏览器中的工作
-
好的...我看到了区别。你在谈论......我在这里找到了你的答案:stackoverflow.com/questions/15038811/…
-
奇怪。所以鼠标悬停事件在 Chrome 中不起作用......对吗?
-
看看这个stackoverflow.com/questions/206997/…他们已经解释清楚了
标签: javascript php html mouseover mousemove