I would like to know how I use onkeydown
and onkeyup
event in javscript correctly with an event listener. I want the event to listen when you just press in the website, not in a text field.
I don't know exactly how the script would look like but hopefully you understand what I want to do. I figured the code would look something like this:
document.addEventListener('keydown', 'keyup', function(event) {
if(event.keyCode == 65){
gas1();
}});
Sorry for being so unclear, trying my best to explain