alert is not popping up

+1 Arnab Banerjee · May 8, 2015
I want to give a lert for a specific keycode but it is not popping up.
here is my code


var canvas = document.getElementById("canvas1");
var context = canvas.getContext("2d");


window.addEventListener("keydown",function(e){
    alert(e.keycode);
    keys[e.keycode] =true;
false)}

window.addEventListener("keyup",function(e){
    delete keys[e.keycode] ;
},false)







Post a Reply

Replies

Oldest  Newest  Rating
+1 Arnab Banerjee · May 9, 2015
Thanks mate it is working now.. :D
+1 Arnab Banerjee · May 8, 2015
Still not working


var canvas = document.getElementById("canvas1");
var context = canvas.getContext("2d");


window.addEventListener("keydown", function(e){
    console.log(e.keycode);
};
  • 1

Javascript

107,170 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators