onkeydown can usually be attached to elements that can receive focus. In some browsers, you can focus on document.body , but you cannot rely on it. window is one of those elements that can get focus.
You can try to put the code below in the head section of your HTML code, after defining TVA .
window.onkeydown = TVA.keyDown;
Or when using addEventListener() :
window.addEventListener('keydown', TVA.keyDown, false);
Teemu source share