The Mint Easter Egg and Making Your Own Javascript Easter Egg

Originally published: 11/2005 by J Wynia

You may have read or seen the "easter egg" that's in the Mint stats package that pops up a graphic when you enter the Konami Nintendo cheat code. I figured some people might like to know how to do their own in a similar fashion. It's only coded for IE, but you'd only have to adjust for the Mozilla event model instead or together. However, only using the one browser makes for a simpler explanation.

Below is the entirety of a demo of how to do this. The simplest way to use it to build your own is to save it to an HTML file, open it in IE. Type the series of keystrokes you'd like as your easter egg trigger and hit the "Reveal" button. The series of numbers you see are your numbers to put into $eastereggcode. What's in there now is "UP UP DOWN DOWN LEFT RIGHT LEFT RIGHT B A", using the arrow keys for the directions. This sample just does a window.alert(), but whatever effect you want would go in that spot if you'd like a more elaborate result.

Your deployed script doesn't need the reveal() function. Otherwise, you just need to put your snippet into the page and wait for people to discover. Or, leak the information like every other good easter egg and enjoy.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script language="JavaScript">
var $keystrokes = "";
var $eastereggcode = "38 38 40 40 37 39 37 39 66 65";
function log_keystrokes($event){
//ie only
$keycode = $event.keyCode;
$keystrokes = $keystrokes + $keycode + " ";
$match = $keystrokes.indexOf($eastereggcode);
if($match > -1){
window.alert("easter egg");
$keystrokes = "";
function reveal(){
<body onkeydown="log_keystrokes(event);">
<button onclick="reveal();">Reveal</button>

easter egg, mint, javascript, web development, fun


Beth on 11/3/2005
Hmm I may have to try this when I put up my new page...
Julien Fabre on 3/18/2006
Man, thanks for the code, it gived me some cool ideas for the credits of the websites i code! :)
Brooklyn on 4/4/2010
There's a wealth of information here. Thanks! I’ll be back for more.
blog comments powered by Disqus
Or, browse the archives.
© 2003- 2015 J Wynia. Very Few Rights Reserved. This article is licensed under the terms of the Creative Commons Attribution License. Quoted content or content included from others is not subject to that license and defaults to normal copyright.