我在Chrome版本50.0.2661.94 m中遇到了mouseover/mousemoove事件的问题。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?