Subscribe to RSS Subscribe to Comments

Alan Blaine Whitney

Keyboard Shortcut

I have found the keyboard shortcuts in gmail very useful. They really have spend up how I use gmail. I would like to start using keyboard shortcuts in my web apps, here is how I intend to do it, with prototype

Event.observe(window, 'load', function() {
Event.observe(document, 'keypress', function(e){
var code;
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
var character = String.fromCharCode(code);
alert('Character was ' + character);
});
});

Pretty cool I think, you replace the alert with whatever you are doing

Comments are closed.

Based on FluidityTheme Redesigned by Kaushal Sheth Sponsored by Send Flowers