in index.html have code. need add onkeydown
event body in main.onload().
any idea how it?
<body id="body" onload="main.onload();" onunload="main.unload();" onmousedown="main.mousedown();" >
<body id="body" onload="main.onload();" onkeydown="tva.keydown(event);" onunload="main.unload();" onmousedown="main.mousedown();" >
in javascript block, try use window.onkeydown
(mdn).
you can use document.onkeydown
, document.body.onkeydown
.
here example you:
javascript
document.body.onkeydown = function(e){ alert(string.fromcharcode(e.keycode)+" --> "+e.keycode); };
live demo
the code above can put in valid javascript block (such main.onload()
function).
Comments
Post a Comment