I've been search the WWW for a while and can't seem to see what I'm looking for... I need a piece of code that will allow my page to move on when someone uses the arrow keys to move forward or back. PLEASE HELP! THANKS... :)
views:
309answers:
1
Q:
Use Left and Right Arrow Keys on keyboard to move onto next html page/last html page... NEED HELP!
+1
A:
Add an event listener to your window that traps the onkeyup event. Then find the keycode for the arrow key left and arrow key right (this will be an integer), and call history.back()
for a left arrow or history.forward()
for a right arrow value.
Robusto
2010-02-24 20:45:20
There’s also a convention of using `<link rel="next" src="URL_OF_NEXT_PAGE_HERE" />` in your `<head>` tag to indicate the next/previous pages in a sequence if “back” doesn’t necessarily mean “the last page in the user’s browser history”. You could read out those values and use them instead of `history.forward()` etc. See e.g. http://diveintohtml5.org/semantics.html#new-relations
Paul D. Waite
2010-02-24 20:53:17