I saw this function from the Internet today. It’s good. I can add this function to the article in the future
var re = /[[(]?/igm;
if (window.document.body.innerHTML.search(re) >= 0) {
var PREVIOUS_PAGE = RegExp.$1;
}
If you search for "previous page", define var PREVIOUS_PAGE = RegExp.$1;
var re = /[[(]?/igm;
if (window.document.body.innerHTML.search(re) >= 0) {
var NEXT_PAGE = RegExp.$1;
}
If you search for "next page", define var NEXT_PAGE = RegExp.$1;
if (typeof PREVIOUS_PAGE == "string" || typeof NEXT_PAGE == "string") {
document.onkeydown = function() {
switch (event.srcElement.tagName) {
case "INPUT":
case "TEXTAREA":
case "SELECT":
break;
default:
if (event.keyCode == 37 /* Arrow Left*/ && typeof PREVIOUS_PAGE == "string") {
window.location. href =PREVIOUS_PAGE; NEXT_PAGE;
}
}
}
}