我有一个鼠标移过一个单元格图像
<td onmouseenter="tdME(1,1)"><img src="row.png"></td>
在Chrome浏览器中,我只能检查全局事件以查看是否按住了Shift键
function tdME(r, c) {
if ( event.shiftKey ) {
// do stuff
}
}
尽管在IE 11中不起作用,是否有一种跨浏览器方法来确定onmouseenter事件是否按住Shift键?
<head>
<script type="text/javascript">
function GetShiftState (event) {
if (event.shiftKey) {
alert ("Shift key is down.");
}
else {
alert ("Shift key is up.");
}
}
</script>
</head>
<body>
Press and hold down the SHIFT key before you click on the button.
<br />
<button onclick="GetShiftState (event);">Get Shift key state!</button>
</body>