传递当前页码,然后去计算就是了,
pg=request("pg")
if(pg<10)
  page_str="pg_000"+pg+".htm"
else
  page_str="pg_00"+pg+".htm"同时计算出上下页

解决方案 »

  1.   

    在每页中加入:
    <script language="javascript">
    var path1,path2
    var pathorg=window.location.href
    var pos=pathorg.indexOf("_")
    var Pvalue=pathorg.substring(pos+1).substring(0,4)
    var pv1=""+(parseInt(Pvalue,10)-1)
    var pv2=""+(parseInt(Pvalue,10)+1)
    path1=pathorg.substring(0,pos+1)+"0000".substring(0,4-pv1.length)+pv1+".htm"
    path2=pathorg.substring(0,pos+1)+"0000".substring(0,4-pv2.length)+pv2+".htm"
    </script>
    <input type=button onclick="window.location.href=path1" value=pre>
    <input type=button onclick="window.location.href=path2" value=next>
      

  2.   

    qiqunet , myvicy  你们的方法是要在每个页面里加入所写的代码,那还不如直接在每个页面的连接里写死
      

  3.   

    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>新しいページ 1</title>
    </head><script language="javascript">
        var nowPage = 1;
    function turnPage(i){
    if(nowPage+i==0 || nowPage+i>10){
    return;
    }else{
        nowPage += i;
        ifrm.location.href=(nowPage ==10)?"pg_0010.html":("pg_000"+(nowPage )+".html");
    }
    }
    </script><body>
    <iframe width="90%" height="80%" align="center" frameborder="1" src="pg_0001.html" name="ifrm" ></iframe><form method="POST" action="--WEBBOT-SELF--">
    <table>
    <tr>
    <td><a href="#" onClick="turnPage(-1)">Pre</a></td>
    <td><a href="#" onClick="turnPage(1)">Next</a></td>
    </tr>
    </table>
    </form></body></html>
      

  4.   

    那就采用框架啦,代码改一点点就行了:
    <input type=button onclick="document.getElementById('showfile').src=readpath(-1);" value=pre>
    <input type=button onclick="document.getElementById('showfile').src=readpath(1);" value=next><br>
    <iframe name="showfile" src="g_0001.htm"></iframe>
    <script language="javascript">
    function readpath(v)
    { var path1
      var pathorg=document.getElementById('showfile').src
      var pos=pathorg.indexOf("_")
      var Pvalue=pathorg.substring(pos+1).substring(0,4)
      var pv2=""+(parseInt(Pvalue,10)+v)
      path1=pathorg.substring(0,pos+1)+"0000".substring(0,4-pv2.length)+pv2+".htm";
      return path1;}
    </script>
      

  5.   

    那就采用框架啦,代码改一点点就行了。新建一个页面,在页面中贴入下面代码,设置好<iframe>框架的src,并将页面保存好:<input type=button onclick="document.getElementById('showfile').src=readpath(-1);" value=pre>
    <input type=button onclick="document.getElementById('showfile').src=readpath(1);" value=next><br><iframe name="showfile" src="pg_0001.htm" width="800" height="600" scrolling="no" frameborder="0"></iframe><script language="javascript">
    function readpath(v)
    { var path1
      var pathorg=document.getElementById('showfile').src
      var pos=pathorg.indexOf("_")
      var Pvalue=pathorg.substring(pos+1).substring(0,4)
      var pv2=""+(parseInt(Pvalue,10)+v)
      path1=pathorg.substring(0,pos+1)+"0000".substring(0,4-pv2.length)+pv2+".htm";
      return path1;}
    </script>