帮我看看这个分页代码,为什么if (PageAll==1)//整页显示不起作用,也就是说当当前页为首页时

heheyiyi 2004-04-05 04:36:55
<p align="center">
<input type="button" class="button" onclick="location.href='?page=1&show_All=0&cond_id=<%=cond_id%>'" id="btnFirstPage" name="btnFirstPage" value="首页">
<input type="button" class="button" onclick="location.href='?page=<%=cstr(m_current_page-1)%>&show_All=0&cond_id=<%=cond_id%>'" id="btnPrevPage" name="btnPrevPage" value="上一页">
<input type="button" class="button" onclick="location.href='?page=<% if cstr(m_page_count)=cstr(m_current_page) then
response.write cstr(m_page_count)
else
m_current_page=cint(m_current_page)+1
response.write cstr(m_current_page)
end if
%>&show_All=0&cond_id=<%=cond_id%>'" id="btnNextPage" name="btnNextPage" value="下一页">
<input type="button" class="button" onclick="location.href='?page=<%=cstr(m_page_count)%>&show_All=0&cond_id=<%=cond_id%>'" id="btnLastPage" name="btnLastPage" value="末页">
<input type="button" class="button" onclick="location.href='?show_All=1&cond_id=<%=cond_id%>'" id="btnAllRecord" name="btnAllRecord" value="全部显示">
<input type="button" class="button" onclick="location.href='?page=1&show_All=0&cond_id=<%=cond_id%>'" id="btnPageRecord" name="btnPageRecord" value="分页显示">
</p>

<SCRIPT LANGUAGE="JAVASCRIPT">
<!--
// declare the variables for the page
var RecordCount=<%=iif(rs_count="",0,rs_count)%>;
var PageSize=10;
var PageCount=Math.ceil(RecordCount/PageSize);
var PageIndex=1;
var pagetemp=<%=iif(m_current_page="",1,m_current_page)%>;
var PageAll=<%=iif(show_All="",0,show_All)%>;//show_All和PageAll为0说明为分页显示

// initialize the page buttons
//<%=show_All%>

if (PageAll==1)//整页显示
{
btnFirstPage.disabled=true;
btnPrevPage.disabled=true;
btnNextPage.disabled=true;
btnLastPage.disabled=true;
btnAllRecord.disabled=true;
btnPageRecord.disabled=false;//只显示分页显示的按钮
}
else//分页显示
{
if (pagetemp==1) //第一页显示
{
btnFirstPage.disabled=true;
btnPrevPage.disabled=true;
btnPageRecord.disabled=true;
btnNextPage.disabled=false;
btnLastPage.disabled=false;
btnAllRecord.disabled=false;
}
else //pagetemp不等于1
{
if (pagetemp<=PageCount-1)//页数在2-(n-1)之间
{
btnFirstPage.disabled=false;
btnPrevPage.disabled=false;
btnNextPage.disabled=false;
btnLastPage.disabled=false;
btnAllRecord.disabled=false;
btnPageRecord.disabled=true;
}
else
{
if (pagetemp==PageCount)//最后一页
{
btnFirstPage.disabled=false;
btnPrevPage.disabled=false;
btnNextPage.disabled=true;
btnLastPage.disabled=true;
btnAllRecord.disabled=false;
btnPageRecord.disabled=true;
}
}
}
}


//-->
</SCRIPT>

还请高手们多多指教,我是看不出什么问题了。在线等,问题很小,完成就结帐。
...全文
96 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
heheyiyi 2004-04-05
  • 打赏
  • 举报
回复
谢谢alcoholwang(工业酒精)
lhl62301 2004-04-05
  • 打赏
  • 举报
回复
接分
alcoholwang 2004-04-05
  • 打赏
  • 举报
回复
自己的一个分页程序~~~~~~~~~~~


Dim CurrentPage,Page_Count,Pcount
Dim TotalRec,EndPage
CurrentPage=Request("Page")
If CurrentPage="" OR NOT isInteger(CurrentPage) OR CurrentPage<1 Then
CurrentPage=1
Else
CurrentPage=Clng(CurrentPage)
If Err Then
CurrentPage=1
Err.Clear
End If
End If

Set rs=server.createobject("adodb.recordset")
SQL="SQL语句"
rs.Open sql,conn,1,1
If Not (rs.Eof AND rs.Bof) Then
rs.PageSize = 每页记录数
rs.AbsolutePage=CurrentPage
Page_Count=0
TotalRec=rs.recordcount
Pcount=rs.PageCount
response.Write("共"&TotalRec&"条记录,共"&Pcount&"页"
If CurrentPage>1 Then
Response.Write("<td>【<a href='?Page="¤tPage-1&"'>上一页</a>】</td>")
End If
If Not CurrentPage=Pcount Then
Response.Write("<td>【<a href='?Page="¤tPage+1&"'>下一页</a>】</td>")
End If
While (Not rs.Eof) and (not Page_Count = 每页数量)
Response.Write("输出内容")
rs.movenext
Page_Count = Page_Count + 1
Wend
rs.close
set rs=nothing
  • 打赏
  • 举报
回复
接分~~
heheyiyi 2004-04-05
  • 打赏
  • 举报
回复
郁闷,自己解决了,来者接分 ,半小时后结帐
heheyiyi 2004-04-05
  • 打赏
  • 举报
回复
还有为什么最后一页不能显示

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧