var down = false;
var olddown = window.onkeydown, oldup = window.onkeyup
var key_w = {keyCode: 87};
setInterval(function() {
if(down)
{olddown(key_w)
oldup(key_w)}}, 50)
onmousedown = function(e) {
switch (e.which) {
case 1: down = true;
}
}
onmouseup = function(e) {
switch (e.which) {
case 1: down = false;
}
}