<script type="text/javascript">
var url=location.href,start=1,end=2;//定义开始页和结尾页
var currentPage=parseInt(/page(\d+)/i.exec(url)[1]);//获取当前页,注意如果你的名称不为page的,修改此正则
if(currentPage<=start)document.write('<font color="#666666">首页 上一页</font>');
else document.write('<a href="page'+start+'.html">首页</a> <a href="page'+(currentPage-1)+'.html">上一页</a>');
document.write(' 当前页:'+currentPage+' ');
if(currentPage>=end)document.write('<font color="#666666">下一页 尾页</font>');
else document.write('<a href="page'+(currentPage+1)+'.html">下一页</a> <a href="page'+end+'.html">尾页</a>');
</script>
var url=location.href,start=1,end=2;//定义开始页和结尾页
var currentPage=parseInt(/page(\d+)/i.exec(url)[1]);//获取当前页,注意如果你的名称不为page的,修改此正则
if(currentPage<=start)document.write('<font color="#666666">首页 上一页</font>');
else document.write('<a href="page'+start+'.html">首页</a> <a href="page'+(currentPage-1)+'.html">上一页</a>');
document.write(' 当前页:'+currentPage+' ');
if(currentPage>=end)document.write('<font color="#666666">下一页 尾页</font>');
else document.write('<a href="page'+(currentPage+1)+'.html">下一页</a> <a href="page'+end+'.html">尾页</a>');
</script>
<script type="text/javascript">
var url=location.href,start=1,end=2;//定义开始页和结尾页
var currentPage=parseInt(/test(\d+)/i.exec(url));//获取当前页,注意如果你的名称不为page的,修改此正则
if(currentPage <=start)document.write(' <font color="#666666">首页 上一页 </font>');
else document.write(' <a href="page'+start+'.html">首页 </a> <a href="page'+(currentPage-1)+'.html">上一页 </a>');
document.write(' 当前页:'+currentPage+' ');
if(currentPage>=end)document.write(' <font color="#666666">下一页 尾页 </font>');
else document.write(' <a href="page'+(currentPage+1)+'.html">下一页 </a> <a href="page'+end+'.html">尾页 </a>');
</script>
我这样就有显示了哦...正则那的下标去掉...
"end=25"这个也改了.
正则改成试试
<script type="text/javascript">
var url=location.href,start=1,end=2;//定义开始页和结尾页
var currentPage=parseInt(/\d+/i.exec(url.replace(/(.*\/){0,}([^\.]+).*/ig,"$2")));//获取当前页“码”(数字)
if(currentPage <=start)document.write(' <font color="#666666">首页 上一页 </font>');
else document.write(' <a href="page'+start+'.html">首页 </a> <a href="page'+(currentPage-1)+'.html">上一页 </a>');
document.write(' 当前页:'+currentPage+' ');
if(currentPage>=end)document.write(' <font color="#666666">下一页 尾页 </font>');
else document.write(' <a href="page'+(currentPage+1)+'.html">下一页 </a> <a href="page'+end+'.html">尾页 </a>');
</script>
保存为:
任意名字X.htm(l)
其中:
任意名字,可以带“-”
X=0,1,2,....
例如:
page-2.html
<script type="text/javascript">
var url=location.href,start=1,end=2;//定义开始页和结尾页
var currentPage=parseInt(/\d+/i.exec(url));//获取当前页,注意如果你的名称不为page的,修改此正则
if(currentPage <=start)document.write(' <font color="#666666">首页 上一页 </font>');
else document.write(' <a href="page'+start+'.html">首页 </a> <a href="page'+(currentPage-1)+'.html">上一页 </a>');
document.write(' 当前页:'+currentPage+' ');
if(currentPage>=end)document.write(' <font color="#666666">下一页 尾页 </font>');
else document.write(' <a href="page'+(currentPage+1)+'.html">下一页 </a> <a href="page'+end+'.html">尾页 </a>');
</script>
不行?
然后document.getElementById('NAV1').innerHTML=str//你前面的储存