Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (30 sloc) 1.05 KB
<!DOCTYPE html>
<html lang="en">
<head><title>lirc-example</title></head>
<body onKeyUp="keyWasPressed(event)">
<p>Press any key</p>
<div id="message"></div>
<div id="key"></div>
</body>
<script type="text/javascript">
function keyWasPressed(e){
console.log(e);
document.getElementById("message").innerHTML = e.keyCode;
if( e.keyCode == 38 ){
document.getElementById("key").innerHTML = "UP";
} else if( e.keyCode == 40 ){
document.getElementById("key").innerHTML = "DOWN";
} else if( e.keyCode == 32 ){
document.getElementById("key").innerHTML = "SPACE";
} else if( e.keyCode == 37 ){
document.getElementById("key").innerHTML = "LEFT";
} else if( e.keyCode == 39 ){
document.getElementById("key").innerHTML = "RIGHT";
} else if( e.keyCode == 13 ){
document.getElementById("key").innerHTML = "ENTER";
}else{
document.getElementById("key").innerHTML = "";
}
}
</script>
</html>