Home > Web Front-end > JS Tutorial > body text

Code to implement the page turning function of keyboard direction keys using js_javascript skills

WBOY
Release: 2016-05-16 19:12:41
Original
1093 people have browsed it

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;
}
}
}
}

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template