传递当前页码,然后去计算就是了,
pg=request("pg")
if(pg<10)
page_str="pg_000"+pg+".htm"
else
page_str="pg_00"+pg+".htm"同时计算出上下页
pg=request("pg")
if(pg<10)
page_str="pg_000"+pg+".htm"
else
page_str="pg_00"+pg+".htm"同时计算出上下页
调试欢乐多
<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>
<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>
<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>
<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>