I would use jQuery, and you can use the following algorithm to check for the multiple keys in a row:
var keysPressed = [];
// U, U, D, D, L, R, L, R
var MAGIC_KEY_SEQUENCE = [ 38, 38, 40, 40, 37, 39, 37, 39 ]
$('body').on('keydown',function(e){
var code = (e.keyCode ? e.keyCode : e.which);
keysPressed.push( code );
if ( keysPressed[ keysPressed.length - 1 ] == MAGIC_KEY_SEQUENCE[ keysPressed.length - 1 ] )
{
// so far so good
if ( keysPressed.length == MAGIC_KEY_SEQUENCE.length )
{
// all keys were pressed in the right order!
alert( 'hurray!' );
$('<link/>').attr({
rel:'stylesheet',
type:'text/css',
href:'sewmuchcss.css'}).appendTo('head');
$.getScript('sewmuchjs.js');
}
}
else
{
// something didn't match, so reset the list
keysPressed = []
}
})
Play with it here:
http://jsfiddle.net/japanick/vfRqk/