codice:
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Esempio</title>
<script type="text/javascript">
function successo () {
	alert("Informazione inviata! Ecco cosa ci ha restituito il server:\n\n" + this.responseText);
}

function errore () {
	alert("Spiacenti. Si \u00E8 verificato un errore.");
}

function catturaTasto (oKeyEvent) {
	var nChar = (oKeyEvent || /* IE */ window.event).charCode;
	if (nChar > 0) {
		var oReq = new XMLHttpRequest();
		oReq.open("get", "lato_server.php?tasto=" + escape(String.fromCharCode(nChar).toLowerCase()), true);
		oReq.onload = successo;
		oReq.onerror = errore;
		oReq.send(null);
	}
}

document.onkeypress = catturaTasto;
</script>
</head>

<body>


Digita un tasto.</p>
</body>

</html>