Home > CMS Tutorial > DEDECMS > How does DEDE achieve the page turning effect of the previous article and the next article?

How does DEDE achieve the page turning effect of the previous article and the next article?

藏色散人
Release: 2020-01-04 09:23:32
Original
2208 people have browsed it

How does DEDE achieve the page turning effect of the previous article and the next article?

How does DEDE achieve the page-turning effect of the previous article and the next article?

Recommended learning: DreamWeaver cms

First enter the DreamWeaver backend; then open the corresponding template file; then add the following code.

<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) 
{ 
event = 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>
Copy after login

The above is the detailed content of How does DEDE achieve the page turning effect of the previous article and the next article?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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