0
我想使用create two keyboard shorcuts。第一個(keyCode == 80
)有效,但不是第二個。我嘗試瞭解決方案here,但沒有成功。
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body style="background-color: #FFC0CB;">
<p><red> Ctrl + P = 1 color // Ctrl + I = 2 colors</red></p>
<p id="log"> </p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$('.warning-bar:first',parent.document).hide();
$(document).ready(function(){
$(document).keydown(function(e){
// 80=p/81=q/73=i/77=m/cf http://keycode.info/
e.preventDefault();
if(e.ctrlKey && e.shiftKey && e.altKey && e.keyCode == 80){
$('#log').html('you pressed Ctrl + p');
google.script.run.added();
}
if(e.ctrlKey && e.shiftKey && e.altKey && e.keyCode == 77){
$('#log').html('you pressed Ctrl + m');
google.script.run.modified();
}
});
});
</script>
}
</body>
</html>
燦你提供HTML進行測試? – Darkisa
@Darkisa,我更新了我的問題 – Enora