我在 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
}
}
最佳答案
你为什么不在这里试试 css?
idname a:hover{color:#000000;background:#ffffff;}
关于javascript - chrome 中的 onmouseover(下拉 - 选项标签)事件不起作用 - php,javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37070223/