澳洲学生假期:asp语句问题,那位高手帮帮忙~~~~~~~~~~~~~~~~~

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/03 06:46:51
我们的网站照片部分不能正常分页,本来设置的一页显示6张照片,但实际上它却所有的都显示,但是第二页显示第6张以后的,第三页显示第12张以后的,以此类推,那位高手帮帮忙给分析一下,谢谢了!谢谢了!
PHOTO_BODY页部分代码如下:
if not request("type")=1 then%><form name="form1" method="post" action="photo.asp?phcat_id=<%=request.querystring

("phcat_id")%>">
<TABLE cellSpacing=1 cellPadding=0 width="530" align=center border=0 bgcolor="#999999">
<TBODY>
<TR>
<TD align=middle width="35%" height=25 bgcolor="#e6e6e6"><IMG height=14 src="img/cha.gif" width=14 align=absMiddle> 共[<font

color="#FF6666"><%=totalcs%></font>]张照片 分[<font color="#FF6666"><%=totalpages%></font>]页</TD>
<TD width="40%" align=middle bgcolor="#e6e6e6"><IMG height=11 src="img/lt.gif" width=11 align=absMiddle>
<%
if CurrentPage<2 then
response.write "<font color='999966'>首页 上一页</font> "
else
response.write "<a href=photo.asp?page=1&phcat_id="&request.querystring("phcat_id")&">首页</a> "
response.write "<a href=photo.asp?page="&CurrentPage-1&"&phcat_id="&request.querystring("phcat_id")&">上一页</a> "
end if
if totalpages-currentpage<1 then
response.write "<font color='999966'>下一页 尾页</font>"
else
response.write "<a href=photo.asp?page="&CurrentPage+1&"&phcat_id="&request.querystring("phcat_id")
response.write ">下一页</a> <a href=photo.asp?page="&totalpages&"&phcat_id="&request.querystring("phcat_id")&">尾页</a>"
end if
%>
<IMG height=11 src="img/gt.gif" width=11 align=absMiddle></TD>
<TD align=middle width="25%" bgcolor="#e6e6e6">
<select name="page" class="lanyu">
<%
i=1
for i=1 to totalpages
if i=currentpage then
%>
<option value=<%=i%> selected>第<%=i%>页</option>
<%else%>
<option value=<%=i%>>第<%=i%>页</option>
<%end if
next%>
</select><input type="submit" name="Submit2" value="转向" class="button"> </TD>
</TR>
</FORM>
</TABLE>
<%end if%>
其中ph_id是照片序列号,
phcat_id是照片分类号,
但是任何分类的页里面都存在同样的问题。

你在显示前要对page进行判断,如果没有给予page参数,就将当前页currentpage置1。因为你没有列出打开数据库和分页的具体代码,无法进一步分析问题,但根据你除了第一页外显示都正常来判断,唯一的区别就是第一页没有给予page参数,检查一下吧。