Edit: on MDN it’s written that the attribute keyCode is deprecated and “key” should be used instead. While keyCode returned a Number, key returns a DOMString.
I think there’s something weird going on here because of the use of the Alt key. For example, changing it to the ctrl key here, works just fine for me:
function KeyPress(e) {
var evtobj = window.event ? event : e
console.log (e.keyCode)
if (evtobj.shiftKey && evtobj.keyCode == 68 && evtobj.ctrlKey) {
alert("GG!");
}
e.preventDefault()
}
document.onkeydown = KeyPress;
Maybe because Alt often changes focus from the web document to the browser navigation?
This might be a stupid question but are you giving the page focus (click the page) before pressing the buttons? Because it won’t work if the focus is in the code box.