captureEvents

admin

Administrator
Staff member
Can anyone tell me what is wrong with this - lifted straight from the DevEdge site:

<script language=javascript>
function callmyfunction()
{
document.write('You pressed a key');
}
document.captureEvents(Event.KEYPRESS);
document.onkeypress = callmyfunction();
</script>

When I put the above on a page to detect when someone clicks anywhere on the page I get a
'Event is undefined' message.
 
Back
Top