Guest User

heitu.pl

a guest
Oct 12th, 2016
66
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function leftArrowPressed() {
  2. alert("leftArrowPressed" );
  3. window.location = prevUrl
  4. }
  5.  
  6. function rightArrowPressed() {
  7. alert("rightArrowPressed" );
  8. window.location = nextUrl
  9. }
  10. function topArrowPressed() {
  11. alert("topArrowPressed" );
  12. window.location = prevUrl
  13. }
  14.  
  15. function downArrowPressed() {
  16. alert("downArrowPressed" );
  17. window.location = nextUrl
  18. }
  19.  
  20. document.onkeydown = function(evt) {
  21. var nextPage = $("#next_page_link")
  22. var prevPage = $("#previous_page_link")
  23. nextUrl = nextPage.attr("href")
  24. prevUrl = prevPage.attr("href")
  25. evt = evt || window.event;
  26. switch (evt.keyCode) {
  27. case 37:
  28. leftArrowPressed(nextUrl);
  29. break;
  30.  
  31. case 38:
  32. topArrowPressed(nextUrl);
  33. break;
  34.  
  35. case 39:
  36. rightArrowPressed(prevUrl);
  37. break;
  38.  
  39. case 40:
  40. downArrowPressed(prevUrl);
  41. break;
  42.  
  43. }
  44. };
RAW Paste Data