PreNext['pre']=" $mlink";"; then call it with js on the content page."/> PreNext['pre']=" $mlink";"; then call it with js on the content page.">

Home >CMS Tutorial >DEDECMS >How does dedecms realize the function of pressing the keyboard direction keys (turning the page of the previous article to the next article)?

How does dedecms realize the function of pressing the keyboard direction keys (turning the page of the previous article to the next article)?

藏色散人
藏色散人Original
2019-12-27 09:33:322244browse

How does dedecms realize the function of pressing the keyboard direction keys (turning the page of the previous article to the next article)?

#dedecmsHow to press the keyboard arrow keys to achieve the (previous article next article page turning) function?

Press the keyboard arrow keys to realize the function of turning the previous article to the next article. I think many webmaster friends want to realize it. In fact, this function is often used in many novel sites and picture sites. Let’s follow Let’s talk about the specific modification operations. If you are interested, don’t miss it. I hope it can help you.

Recommended study: 梦Weavercms

In fact, this function is It is often used by many novel sites and picture sites. You can pay attention to it. This tutorial is provided by enthusiastic netizens on the forum. Let’s talk about the specific modification operations:

First we open include/arc.archives.class .php Find the following code:

The code is as follows:

$this->PreNext[&#39;pre&#39;] = "上一篇:<a href=&#39;$mlink&#39;>{$preRow[&#39;title&#39;]}</a> ";

Replace it with the following code:

The code is as follows:

$this->PreNext[&#39;pre&#39;] = "$mlink "; 
$this->PreNext[&#39;next&#39;] = "下一篇:<a href=&#39;$mlink&#39;>{$nextRow[&#39;title&#39;]}</a> ";

The php code is modified It can be saved, and then we use js to call it on the content page. Add the following code:

The code is as follows:

<script type="text/javascript" language="javascript"> 
<!-- 
document.onkeydown=nextpage; 
var prevpage=&#39;{dede:prenext get=&#39;pre&#39;/}&#39;; 
var nextpage=&#39;{dede:prenext get=&#39;next&#39;/}&#39;; 
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!=&#39;&#39; && prevpage!=&#39;上一篇:没有了 &#39;) 
location=prevpage; 
else 
alert(&#39;这是第一页&#39;); 
} 
if (event.keyCode==39) 
{ 
if (nextpage!=&#39;&#39; && nextpage!=&#39;下一篇:没有了 &#39;) 
location=nextpage; 
else 
alert(&#39;已经是最后一页了&#39;); 
} 
} 
//--> 
function getElement(aID) 
{ 
return (document.getElementById) ? document.getElementById(aID): document.all[aID]; 
} 
function makeRequest(url){ 
http_request=false; 
if(window.XMLHttpRequest){//Mozilla,Safari,... 
http_request=new XMLHttpRequest(); 
if(http_request.overrideMimeType){ 
http_request.overrideMimeType(&#39;text/xml&#39;); 
} 
}else if(window.ActiveXObject){//IE 
try{ 
http_request=new ActiveXObject("Msxml2.XMLHTTP"); 
}catch(e){ 
try{ 
http_request=new ActiveXObject("Microsoft.XMLHTTP"); 
}catch(e){} 
} 
} 
if(!http_request){ 
alert(&#39;Giving up:(Cannot create an XMLHTTP instance)&#39;); 
return false; 
} 
return http_request; 
} 
</script>

is added to the position before 6c04bd5ca3fcae76e30b72ad730ca86d. In this way, all modifications are completed, and then we will update the document to see the effect.

The above is the detailed content of How does dedecms realize the function of pressing the keyboard direction keys (turning the page of the previous article to the next article)?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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