Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19088

Determining the key pressed within an HTML onkeypress event handler

Newsgroups comp.lang.javascript
Date 2013-03-31 15:06 -0700
Message-ID <85567ec3-133a-4d70-8deb-301ff0876779@googlegroups.com> (permalink)
Subject Determining the key pressed within an HTML onkeypress event handler
From "John L." <johnlarew@sbcglobal.net>

Show all headers | View raw


I have an HTML JavaScript similar to this:

<HTML>
<SCRIPT>
function pressed() {
   window.alert("Key pressed");
}
</SCRIPT>
<BODY onkeypress="javascript: pressed();">
</BODY>
</HTML>

How can I tell which key was pressed? The JavaScript reference I use describes both Event and KeyboardEvent objects, but gives no examples as to how to access them or use them.

Thanks in advance for any help you can provide. 

Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

Determining the key pressed within an HTML onkeypress event handler "John L." <johnlarew@sbcglobal.net> - 2013-03-31 15:06 -0700
  Re: Determining the key pressed within an HTML onkeypress event handler Tim Streater <timstreater@greenbee.net> - 2013-03-31 23:33 +0000
    Re: Determining the key pressed within an HTML onkeypress event handler "John L." <johnlarew@sbcglobal.net> - 2013-03-31 17:02 -0700

csiph-web