tags:

views:

61

answers:

1

Could someone help me create some javascript to perform the following behavior. Upon the entering of Konami Code while at a website (see:: http://files.www.gethifi.com/posts/konami/index.html for example), I want an mp3 to start playing in the background. I want to do this without any external library, such as jQuery.

Thanks in advance for your help!

A: 

You can start with the onKeyUp event, which gives you access to the keyCode property. You need a way to keep track of the keys pressed and you need to check each time to see if they match up to the Konami Code.

To play an MP3, take a look at the object tag and also see if you can add it to the DOM programmatically. Using all this information, it should be trivial for you to figure out how to write it all together.

Vivin Paliath