Best I can tell from a quick glance is that you are comparing the wrong
things. I think what you want to do is this:

konami.indexOf( kkeys.toString() )

However the logic looks off to me. You just keep adding to the array without
ever clearing it, so the array is going to get massive if the user is typing
(for instance) or if the keystrokes don't come in a very specific way. Maybe
that's what you want though?



On Tue, Apr 28, 2009 at 2:37 PM, CFTodd <cft...@gmail.com> wrote:

>
> My javascript is WAY rusty.  Coudl someone take a quick look at this and
> tell me what bonehead thing I am doing wrong?
>
> This works in FF, but not IE.
>
> if(window.addEventListener) {
>    alert("ff detected");
>        var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
>        window.addEventListener('keydown', function(e) {
>                kkeys.push( e.keyCode );
>        //alert(e.keyCode);
>                if ( kkeys.toString().indexOf( konami ) >= 0 )
>
>                        window.location="http://www.google.com";;
>    }, true)
> }
> else if(window.attachEvent) {
>    alert("ie detected");
>    var kkeys = [], konami = "38,38,40,40,37,39,37,39,66,65";
>    window.attachEvent('onKeyDown', function(e) {
>                kkeys.push( e.keyCode );
>        alert(e.keyCode);
>                if ( kkeys.toString().indexOf( konami ) >= 0 )
>
>                        window.location="http://www.google.com";;
>    }, true)
> }
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-community/message.cfm/messageid:296345
Subscription: http://www.houseoffusion.com/groups/cf-community/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5

Reply via email to