<script type="text/javascript">
var url=location.href,start=1,end=25;//定义开始页和结尾页 
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="lecon'+start+'.html">首页 </a>  <a href="lecon'+(currentPage-1)+'.html">上一页 </a> 当前页:'+currentPage+' '); 
if(currentPage>=end)document.write(' <font color="#666666">下一页 尾页 </font>'); 
else document.write(' <a href="lecon'+(currentPage+1)+'.html">下一页 </a>  <a href="lecon'+end+'.html">尾页 </a>'); 
</script>

解决方案 »

  1.   

    function abc(kkk){
    var url=location.href,start=1,end=25;//定义开始页和结尾页 
    var currentPage=parseInt(/\d+/i.exec(url.replace(/(.*\/){0,}([^\.]+).*/ig,"$2")));//获取当前页“码”(数字) 
    var str="";
    if(currentPage <=start)str+=' <font color="#666666">首页 上一页 </font>'; 
    else str+=' <a href="lecon'+start+'.html">首页 </a>  <a href="lecon'+(currentPage-1)+'.html">上一页 </a> 当前页:'+currentPage+' '; 
    if(currentPage>=end)str+=' <font color="#666666">下一页 尾页 </font>'; 
    else str+=' <a href="lecon'+(currentPage+1)+'.html">下一页 </a>  <a href="lecon'+end+'.html">尾页 </a>'; 
    document.getElementById(kkk).innerHTML+=str;
    }
    window.onload=function(){
    abc('NAV1');
    abc('NAV2');
    }
      

  2.   

    怎么natineprince 代码放进去,网页其它的部分全部不显示了
      

  3.   

    test:<html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建网页 1</title>
    <script language="javascript">
    <!--
    var url=location.href,start=1,end=25;//定义开始页和结尾页 
    var currentPage=parseInt(/\d+/i.exec(url.replace(/(.*\/){0,}([^\.]+).*/ig,"$2")));//获取当前页“码”(数字) 
    function setPage(id){
    var str="";if(currentPage <=start)str+=' <font color="#666666">首页 上一页 </font> 当前页:'+currentPage+' '; 
    else str+=' <a href="lecon'+start+'.html">首页 </a>  <a href="lecon'+(currentPage-1)+'.html">上一页 </a> 当前页:'+currentPage+' '; if(currentPage>=end)str+=' <font color="#666666">下一页 尾页 </font>'; 
    else str+=' <a href="lecon'+(currentPage+1)+'.html">下一页 </a>  <a href="lecon'+end+'.html">尾页 </a>'; document.getElementById(id).innerHTML+=str;
    }
    //-->
    </script>
    </head><body>
    <div id=NAV1><script language="javascript">setPage("NAV1")</script></div>
    <div id=con style="height:200px;border:1px #aaa solid"></div>
    <div id=NAV2><script language="javascript">setPage("NAV2")</script></div><script language="javascript">
    </script>
    </body></html>