Blogger 寻呼机代码不起作用
Posted
技术标签:
【中文标题】Blogger 寻呼机代码不起作用【英文标题】:Blogger pagger code not working 【发布时间】:2016-03-19 05:55:36 【问题描述】:我正在为我的博客使用博客自定义模板,但我的寻呼机代码在这里不起作用。请帮助解决问题。我在互联网上尝试了很多代码,但页码没有链接到下一页。
我发布了不起作用的 div 代码:
<div class="pagenav">
<script type="text/javascript">
var pageNaviConf =
perPage: 6,
numPages: 5,
firstText: "First",
lastText: "Last",
nextText: "Next",
prevText: "Prev"
</script>
<script type="text/javascript">
//<![CDATA[
function pageNavi(o)var m=location.href,l=m.indexOf("/search/label/")!=-1,a=l?m.substr(m.indexOf("/search/label/")+14,m.length):"";a=a.indexOf("?")!=-1?a.substr(0,a.indexOf("?")):a;var g=l?"/search/label/"+a+"?updated-max=":"/search?updated-max=",k=o.feed.entry.length,e=Math.ceil(k/pageNaviConf.perPage);if(e<=1)returnvar n=1,h=[""];l?h.push("/search/label/"+a+"?max-results="+pageNaviConf.perPage):h.push("/?max-results="+pageNaviConf.perPage);for(var d=2;d<=e;d++)var c=(d-1)*pageNaviConf.perPage-1,b=o.feed.entry[c].published.$t,f=b.substring(0,19)+b.substring(23,29);f=encodeURIComponent(f);if(m.indexOf(f)!=-1)n=dh.push(g+f+"&max-results="+pageNaviConf.perPage)pageNavi.show(h,n,e)pageNavi.show=function(f,e,a)var d=Math.floor((pageNaviConf.numPages-1)/2),g=pageNaviConf.numPages-1-d,c=e-d;if(c<=0)c=1endPage=e+g;if((endPage-c)<pageNaviConf.numPages)endPage=c+pageNaviConf.numPages-1if(endPage>a)endPage=a;c=a-pageNaviConf.numPages+1if(c<=0)c=1var b='<span class="pages">Pages '+e+' of '+a+"</span> ";if(c>1)b+='<a href="'+f[1]+'">'+pageNaviConf.firstText+"</a>"if(e>1)b+='<a href="'+f[e-1]+'">'+pageNaviConf.prevText+"</a>"for(i=c;i<=endPage;++i)if(i==e)b+='<span class="current">'+i+"</span>"elseb+='<a href="'+f[i]+'">'+i+"</a>"if(e<a)b+='<a href="'+f[e+1]+'">'+pageNaviConf.nextText+"</a>"if(endPage<a)b+='<a href="'+f[a]+'">'+pageNaviConf.lastText+"</a>"document.write(b);(function()var b=location.href;if(b.indexOf("?q=")!=-1||b.indexOf(".html")!=-1)returnvar d=b.indexOf("/search/label/")+14;if(d!=13)var c=b.indexOf("?"),a=(c==-1)?b.substring(d):b.substring(d,c);document.write('<script type="text/javascript" src="/feeds/posts/summary/-/'+a+'?alt=json-in-script&callback=pageNavi&max-results=99999"><\/script>')elsedocument.write('<script type="text/javascript" src="/feeds/posts/summary?alt=json-in-script&callback=pageNavi&max-results=99999"><\/script>'))();
//]]>
</script><script type="text/javascript" src="/feeds/posts/summary?alt=json-in-script&callback=pageNavi&max-results=99999"></script><span class="pages">Pages 2 of 6</span> <a href="/?max-results=6">Prev</a><a href="/?max-results=6">1</a><span class="current">2</span><a href="/search?updated-max=2016-02-11T02%3A17%3A00-08%3A00&max-results=6">3</a><a href="/search?updated-max=2016-02-01T23%3A45%3A00-08%3A00&max-results=6">4</a><a href="/search?updated-max=2016-01-31T21%3A48%3A00-08%3A00&max-results=6">5</a><a href="/search?updated-max=2016-02-11T02%3A17%3A00-08%3A00&max-results=6">Next</a><a href="/search?updated-max=2016-01-27T01%3A22%3A00-08%3A00&max-results=6">Last</a>
<div class="clear"></div>
</div>
【问题讨论】:
欢迎来到 ***!习惯上解释您希望代码做什么,以及您所看到的。 “不工作”描述了该网站上 90% 的帖子,因此不够具体。 ;-) 我的博客是 sikhtera.blogspot.com 页面导航在底部不起作用,它显示页码,但是当我将鼠标悬停在页码上时它们被禁用,它没有显示为链接..还有什么你想请告诉 【参考方案1】:使用这个:
<div class='pagenavi'>
<script type='text/javascript'>
var pageNaviConf =
perPage: 7,
numPages: 5,
firstText: "First",
lastText: "Last",
nextText: "»",
prevText: "«"
</script>
<script type='text/javascript'>/*
* Awesome Blogger Page Navigation by Onlinetrick *
* Rev 248 on May 7, 2010 *
* Source at http://code.google.com/p/rilwis/source/browse/trunk/blogger *
*/
function pageNavi(o)
var m=location.href,
l=m.indexOf("/search/label/")!=-1,
a=l?m.substr(m.indexOf("/search/label/")+14,m.length):"";
a=a.indexOf("?")!=-1?a.substr(0,a.indexOf("?")):a;
var g=l?"/search/label/"+a+"?updated-max=":"/search?updated-max=",
k=o.feed.entry.length,
e=Math.ceil(k/pageNaviConf.perPage);
if(e<=1)
return
var n=1,
h=[""];
l?h.push("/search/label/"+a+"?max-results="+pageNaviConf.perPage):h.push("/?max-results="+pageNaviConf.perPage);
for(var d=2;d<=e;d++)
var c=(d-1)*pageNaviConf.perPage-1,
b=o.feed.entry[c].published.$t,
f=b.substring(0,19)+b.substring(23,29);
f=encodeURIComponent(f);
if(m.indexOf(f)!=-1)
n=d
h.push(g+f+"&max-results="+pageNaviConf.perPage)
pageNavi.show(h,n,e)
pageNavi.show=function(f,e,a)
var d=Math.floor((pageNaviConf.numPages-1)/2),
g=pageNaviConf.numPages-1-d,
c=e-d;
if(c<=0)
c=1
endPage=e+g;
if((endPage-c)<pageNaviConf.numPages)
endPage=c+pageNaviConf.numPages-1
if(endPage>a)
endPage=a;
c=a-pageNaviConf.numPages+1
if(c<=0)
c=1
var b='<span class="pages">Page '+e+' of '+a+"</span> ";
if(c>1)
b+='<a href="'+f[1]+'">'+pageNaviConf.firstText+"</a>"
if(e>1)
b+='<a href="'+f[e-1]+'">'+pageNaviConf.prevText+"</a>"
for(i=c;i<=endPage;++i)
if(i==e)
b+='<span class="current">'+i+"</span>"
else
b+='<a href="'+f[i]+'">'+i+"</a>"
if(e<a)
b+='<a href="'+f[e+1]+'">'+pageNaviConf.nextText+"</a>"
if(endPage<a)
b+='<a href="'+f[a]+'">'+pageNaviConf.lastText+"</a>"
document.write(b)
;
(function()var b=location.href;if(b.indexOf("?q=")!=-1||b.indexOf(".html")!=-1)returnvar d=b.indexOf("/search/label/")+14;if(d!=13)var c=b.indexOf("?"),a=(c==-1)?b.substring(d):b.substring(d,c);document.write('<script type="text/javascript" src="/feeds/posts/summary/-/'+a+'?alt=json-in-script&callback=pageNavi&max-results=99999"><\/script>')elsedocument.write('<script type="text/javascript" src="/feeds/posts/summary?alt=json-in-script&callback=pageNavi&max-results=99999"><\/script>'))();</script>
<div class='clear'/>
</div>
【讨论】:
以上是关于Blogger 寻呼机代码不起作用的主要内容,如果未能解决你的问题,请参考以下文章
Onclick on view pager in android 在我的代码中不起作用
设置为 diff-highlight 的 Git 寻呼机在 Windows 10 中不起作用
tablesorterPager 不起作用。 (带有错误信息)