/    Sign up×
Community /Pin to ProfileBookmark

Keyboard events on IE don’t work

Hi, I am trying to get this code to work in IE.[B] It works on Firefox[/B], but not on IE. Basically it blocks out scrolling the page down with space button, and registers up and down keys to run some [I]code[/I]. The entire case statement including event registering and my [I]code[/I] works completely fine in FF but it just won’t work in IE (meaning that I can scroll down with space, and up and down with the up and down keys respectively).

Here’s the code, any help would be much appreciated. By the way I put this function in the HEAD section.

[code=php]window.onkeydown = function(event)
{
// No space scrolling!
switch (event.keyCode)
{
case 32: return false; break;
case 38:
{
if (rB_Script.last_item <= 1000)
{
return;
}
else
{
rB_Script.focus_on_step(rB_Script.last_item – 1);
}
return false; break;
}
case 40:
{
if (rB_Script.last_item >= rB_Script.final_item)
{
return;
}
else if (rB_Script.last_item != -1)
{
rB_Script.focus_on_step(rB_Script.last_item + 1);
}
else
{
rB_Script.focus_on_step(1000);
}
return false; break;
}
}
}[/code]

[B]Thank you very much![/B]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @pilau spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...