<input id="test1" type="text" value="按ctrl+a"></input>
<script>document.getElementById("test1").onkeydown=function(e){
//??此处应该怎么写
}
</script>
怎样监控到用户按了ctrl+a键?
foo=function(e){
console.log(e.ctrlKey,e.altKey,e.keyCode);
}
document.addEventListener("keydown",foo);
判断按 a 的时候 ctrl 是否被按下即可。事件触发不存在同时,肯定是会有先后顺序的,也不存在先按 a 再按 ctrl 的人吧