vitorrio,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
</head>
<body>
<script>
try
{
function fire(){
var press=new KeyboardEvent('keypress',{
key:'а',
bubbles:true,
cancelable:true,
isTrusted:true,
keyCode:97,
charCode:97,
which:97,
view:window
});
document.body.dispatchEvent(press);
};
document.body.addEventListener("keypress",function(event){
alert("Вы нажали "+event.key);
},false);
fire();
}
catch(err)
{
alert(err);
}
</script>
</body>
</html>