程序中用到快捷鍵功能,用alt+d表示刪除,ie6下可以,但到ie11後,alt+d不能掉到js方法。
下面是html測試
按其它鍵能打出log,按alt+d不能進入方法。求解決。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
測試ie11下,alt+d無效
<script type="text/javascript">
document.onkeydown = function(e){
if (window.event.keyCode==18) {
window.event.returnValue=false;
return false;
}
console.log(window.event);
window.event.cancelBubble=true;
}
</script>
</body>
</html>