<script>

document.onkeydown = function(e) {
  var a = document.getElementById("test");
  a.innerHTML = a.innerHTML + String.fromCharCode(e.which);

  var a = document.getElementById("test2");
  a.innerHTML = a.innerHTML + e.which + " " ;    

  return false;
}
</script>

<div id="test"></div>
<hr>
<div id="test2"></div>

SmartButton TM –>

So I got my hands on a smartbutton from sourceforge while at today’s SOCHI/SCSI event.

I was curious how it worked, so I wrote a very simple javascript to capture all keyboard input into the browser window and print it to the display.

Interestingly the SmartButtonTM acts just like a keyboard, and sends the following keycodes to the active window, or OS:

224 82 87 87 87 190 83 79 85 82 67 69 70 79 82 71 69 190 78 69 84 13

Which is essentially APPLE_CMD+R + http://www.sourceforge.net [enter]

http://unixpapa.com/js/key.html was a very useful and very interesting read.

Advertisements