Idea presa su stackoverflow.
codice HTML:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<script>
function showUser(val) {
document.getElementById('a').innerHTML = val;
}
function pippo(val) {
var a = document.getElementById("nome");
a.value += val;
var evnt = a["onkeyup"];
if (typeof(evnt) == "function") {
evnt.call(a);
}
}
</script>
Msg <input type="text" id="nome" onKeyUp="showUser(this.value)" size="30"/>
<div id="a"></div>
<hr/>Tastiera<hr/>
<Input type='button' value='A' onclick="pippo(this.value)" />
<Input type='button' value='B' onclick="pippo(this.value)" />
<Input type='button' value='C' onclick="pippo(this.value)" />
</body>
</html>