Fandom

How To Wiki

How to create a webpage that changes by pressing keyboard keys with JavaScript

1,796pages on
this wiki
Add New Page
Talk0 Share

You can use the following script:

<SCRIPT language=JavaScript> 
document.onkeypress=j;
function j(){
{if(event.keyCode==13)document.onkeypress=40}
{if(event.keyCode==97)window.location="URL"}
.
.
.
}
</SCRIPT>

How to use it...

keyCode defines the key that you press.

1
2
3
4
27 
38 arrow up
40 arrow down
37 arrow left
39 arrow right
97
98 : b

External LinksEdit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.