js分页代码(by airzen modified 2004/05/13)
<script language="javascript" type="text/javascript" >
function showpage(url,num,c_p)
{
if (num<8)
{
stnum=num
}
else
{
stnum=8
}
for (i=1;i<=stnum;i++)
{
if (i==c_p){
document.write (i+" ");
}else{
document.write ("<a href="+url+"&page="+i+">"+i+"</a>"+" ");
}
}
document.write ("…"+"<a href="+url+"&page="+num+">"+num+"</a>"+" ");
}
</script>
调用示例:
<script language="javascript" type="text/javascript" >
showpage("123.asp?id=5",10,5)
</script>
<script language="javascript" type="text/javascript" >
showpage("123.asp?id=5",5,2)
</script>