The implementation of the Zhimeng system is achieved by pressing the keyboard direction key.

Source: Internet
Author: User
Tags php and php code

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.