PreNext['pre'] = "$mlink ";"; then Just use JS code to call it in the content page."/> PreNext['pre'] = "$mlink ";"; then Just use JS code to call it in the content page.">
Home > Article > CMS Tutorial > How to use the keyboard to turn pages up and down in DEDECMS
How does DEDECMS use the keyboard to turn pages up and down?
Dream Weaver DEDECMS realizes the effect of turning pages up and down using the keyboard
Recommended learning: Dream Weaver cms
In fact, this function is used in many novel sites , picture sites are often used, you can pay attention to it. This tutorial is provided by enthusiastic netizens on the forum. Here are the specific modification steps:
First we open include/arc.archives.class.php
Find the following code:
$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";
Replace it with the following code:
$this->PreNext['pre'] = "$mlink "; $this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";
In this way, the php code has been modified and can be saved. Next, we use js to call it on the content page. Add the following 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) { 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!='' && prevpage!='上一篇:没有了 ') location=prevpage; else alert('这是第一页'); } if (event.keyCode==39) { if (nextpage!='' && nextpage!='下一篇:没有了 ') location=nextpage; else alert('已经是最后一页了'); } } //--> 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('text/xml'); } }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('Giving up:(Cannot create an XMLHTTP instance)'); return false; } return http_request; } </script>
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 to use the keyboard to turn pages up and down in DEDECMS. For more information, please follow other related articles on the PHP Chinese website!