Sunday, October 31, 2010


A class to automatically detect entries from a hardware device that generates keystrokes (like a barcode scanner).


This class is designed on the assumption that your barcode scanner hardware will act like a keyboard. As a barcode is scanned a series of keypress events will be generated by the device. If these key events are in fast enough succession (the order of milliseconds), then it can be assumed that a scanner device pushed the series of key events. Otherwise it is just normal human input and will be ignored by the barcode reader class.

How to use

Include the following code in the head of your web page.

 <script src="" language="JavaScript" type="text/javascript" ></script>
<script src="ScannerKeystrokeObserver.js" ></script>
new ScannerKeystrokeObserver({
onRead: function(v) {
$('txtGlobal').set('value', v).highlight();

Get It

Post a Comment