织梦按键盘方向键怎么实现上一篇下一篇翻页
织梦按键盘方向键怎么实现上一篇下一篇翻页
这个功能在很多小说站,图片站经常用到,大家可以留意一下,下面来讲讲具体的修改方法让织梦实现上下翻页效果:
实现步骤:
1、首先我们打开 include/arc.archives.class.php 查找到以下代码:$this->PreNext['pre'] = "上一篇:<a href='$mlink'>{$preRow['title']}</a> ";替换成以下代码:$this->PreNext['pre'] = "$mlink ";$this->PreNext['next'] = "下一篇:<a href='$mlink'>{$nextRow['title']}</a> ";这样php代码就修改完了可以保存。
2、接下来我们在内容页用js进行调用.把以下代码:<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=bookpageif (event.keyCode == 13) location = index_pageif (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) { //IEtry {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>加到<body>之前的位置.这样就全部修改完了。
3、最后我们更新文档即可。
推荐教程:dedecms教程以上就是织梦按键盘方向键怎么实现上一篇下一篇翻页的详细内容,更多请关注小潘博客其它相关文章!