First look at a code js press the keyboard direction key code
The code is as follows: |
Copy code |
<SCRIPT language = javascript> Document. onkeydown = pageEvent; Var prevpage = "http://www.111cn.net /"; Var nextpage = "http://www.111cn.net /"; Function pageEvent (evt ){ Evt = evt | window. event; Var key = evt. which | evt. keyCode; If (key = 37) location = prevpage If (key = 39) location = nextpage }; </SCRIPT> |
NOTE: Press the keyboard & larr; & rarr; direction key or PageUp PageDown key to flip the page.
Now let's go to the topic.
First, open include/arc. archives. class. php and find the following code:
The code is as follows:
The code is as follows: |
Copy code |
$ This-> PreNext ['pre'] = "previous: <a href = '$ mlink' >{$ preRow ['title']} </a> "; |
Replace it with the following code:
The code is as follows: |
Copy code |
$ This-> PreNext ['pre'] = "$ mlink "; |
$ This-> PreNext ['Next'] = "next article: <a href = '$ mlink' >{$ nextRow ['title']} </a> ";
In this way, the php code can be modified and saved. Next, we will call the code in js on the content page:
The following operations are performed on the template page:
The code is as follows: |
Copy code |
<Script type = "text/javascript" language = "javascript"> <! -- Document. onkeydown = nextpage; Var prevpage = '{dede: prenext get = 'pre '/}'; Var nextpage = '{dede: prenext get = 'next '/}'; Var index_page = "index.html "; // Var bookpage = "index.html "; Function nextpage (event) { Eventevent = event? Event: (window. event? Window. event: null ); // If (event. keyCode = 13) location = bookpage If (event. keyCode = 13) location = index_page If (event. keyCode = 37) { If (prevpage! = ''& Prevpage! = 'Previous article: no exist ') Location = prevpage; Else Alert ('This is the first page '); } If (event. keyCode = 39) { If (nextpage! = ''& Nextpage! = 'Next article: no exist ') Location = nextpage; Else Alert ('the last page '); } } // --> Function getElement (aID) { Return (document. getElementById )? Document. getElementById (aID): document. all [aID]; } </Script> |