/    Sign up×
Community /Pin to ProfileBookmark

Can PHP capture keypress event ??

Are there any PHP function that capture keypress event in browser window ??
By the way, someone tell me keycode of ESC, Alt, Ctrl, Shift. Thank for helping.

to post a comment
PHP

10 Comments(s)

Copy linkTweet thisAlerts:
@SpectreReturnsDec 06.2005 — Nope.
Copy linkTweet thisAlerts:
@ShrineDesignsDec 06.2005 — you will need to use JavaScript to capture the key and send it to PHP
Copy linkTweet thisAlerts:
@Shishio_MakotoauthorDec 06.2005 — Yeap,

Can you show me keycode of ESC, Alt, Ctrl, Shift ?

Thanks ?
Copy linkTweet thisAlerts:
@bathurst_guyDec 06.2005 — Key Code

ESC ?

Alt 18

Ctrl 17

Shift 16
Copy linkTweet thisAlerts:
@redfoxDec 06.2005 — esc 27
Copy linkTweet thisAlerts:
@ShrineDesignsDec 06.2005 — don't the left and right (alt, ctrl, shift) keys have different values?
Copy linkTweet thisAlerts:
@redfoxDec 06.2005 — here's the code to test keyCodes

try testing your questions?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>keyCode Property</TITLE>

<META http-equiv=Content-Type content="text/html; charset=shift_jis">

<STYLE type=text/css>TD {

TEXT-ALIGN: center

}

</STYLE>

<SCRIPT language=JavaScript>

function showCode(which) {

document.forms[0].elements[which].value = event.keyCode

}

function clearEm() {

for (var i = 1; i < document.forms[0].elements.length; i++) {

document.forms[0].elements[i].value = ""

}

}

</SCRIPT>



<META content="MSHTML 6.00.3790.2491" name=GENERATOR></HEAD>

<BODY>

<H1>keyCode Property</H1>

<HR>



<P></P>

<FORM>

<P><TEXTAREA onkeypress="showCode('press')" onkeydown="clearEm(); showCode('down')" onkeyup="showCode('up')" name=scratchpad rows=5 wrap=hard cols=40></TEXTAREA>

</P>

<TABLE cellPadding=5>

<TBODY>

<TR>

<TH>Event</TH>

<TH>event.keyCode</TH></TR>

<TR>

<TD>onKeyDown:</TD>

<TD><INPUT size=3 name=down></TD></TR>

<TR>

<TD>onKeyPress:</TD>

<TD><INPUT size=3 name=press></TD></TR>

<TR>

<TD>onKeyUp:</TD>

<TD><INPUT size=3 name=up></TD></TR></TBODY></TABLE></FORM></BODY></HTML>
Copy linkTweet thisAlerts:
@insaneDec 06.2005 — your code doesn't work ("event" is not defined)

and please put your code in
<i>
</i>[code] tags


[i]-Insane[/i]
Copy linkTweet thisAlerts:
@Shishio_MakotoauthorDec 07.2005 — yeah, it works. Thank you very much
Copy linkTweet thisAlerts:
@SpectreReturnsDec 08.2005 — [b]event[/b] is IE only (I think).
×

Success!

Help @Shishio_Makoto spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...