<head>
<SCRIPT type=text/javascript>
var $ = {
enabled: false,
tmp: Array(),
_konamiCode: Array(65,66,39,37,39,37,40,40,38,38),
init: function() {
this.tmp = Array(65,66,39,37,39,37,40,40,38,38);
},
konamiCode: function(e) {
if(!this.enabled) {
var t = this.tmp.pop();
if((e.keyCode-t) == 0) {
if(this.tmp.length == 0) {
this.enabled = true;
}
}
else {
this.init();
}
}
else {
this.action();
}
},
// Change the action() function to whatever you want to
action: function() {
alert("Konami Code Activated");
}
}
</SCRIPT>
</head>
<body onload="$.init()" onkeydown="$.konamiCode(event)">
</body>
<head>
<SCRIPT type=text/javascript>
var k=[];
function konamiCode(e){
k.push(e.keyCode);
if(k.toString().indexOf("38,38,40,40,37,39,37,39,66,65")>=0) {
alert("Konami Code Activated");
}
}
</SCRIPT>
</head>
<body onkeydown="konamiCode(event)">
</body>
Via:
《Konami Code on Facebook : How to implement it on your site》