congdantoancau

Url replace

Jan 22nd, 2018
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(document).ready(function() {
  2.     var url = location.href;
  3.     var bourn = url.lastIndexOf('/') + 1;
  4.     var page = eval(url.substr(bourn));
  5.     var extant =  url.substring(0,bourn);
  6.     var next;
  7.     $(document).keyup(function(e) {
  8.         if (e.which == 39) {
  9.             next = extant + (page+1);
  10.             window.open(next, '_self');
  11.         }
  12.         if (e.which == 37) {
  13.             next = extant + (page-1);
  14.             window.open(next, '_self');            
  15.         }
  16.     });
  17. });
Advertisement
Add Comment
Please, Sign In to add comment