最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
在ASP中,用JScript脚本实现分页的另类办法。
时间:2022-06-30 11:22:05 编辑:袖梨 来源:一聚教程网
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="936"%>
<%
var DataSet,sql,DataList;
var i=0;
var j=0;
DataList=new News();
DataSet=Server.CreateObject("Adodb.recordset");
sql="select * from News where ngroup='集团新闻' order by id desc";
DataSet.Open(sql,DataConn,1,1);
//是否有数据
if ((DataSet.eof)&&(DataSet.bof))
{
Response.Write("
" );
Response.Write("=== 暂无 ===");
Response.Write("
");
Response.End();
}
//记录总数
NumRecords=DataSet.RecordCount;
//设定每页最大记录数
PageSize=3;
//总页数
NumPages=Math.ceil(NumRecords/PageSize);
//当前页
i=Request.QueryString("CurrentPageID").Count;
if (i==0)
{
CurrentPageID=1;
}
else
{
CurrentPageID=parseInt(Request.QueryString("CurrentPageID"));
}
//初始化
PreviousPageID=CurrentPageID-1;
NextPageID=CurrentPageID+1;
HomePage=1;
EndPage=NumPages;
//内容列表
DataSet.MoveFirst;
DataSet.Move((CurrentPageID-1)*PageSize,1);
while (!DataSet.eof && j {
Response.Write(""+DataSet("subject")+"
");
j=j+1;
DataSet.MoveNext;
}
//设定URL
if (CurrentPageID == HomePage)
{
Response.Write("
<%
var DataSet,sql,DataList;
var i=0;
var j=0;
DataList=new News();
DataSet=Server.CreateObject("Adodb.recordset");
sql="select * from News where ngroup='集团新闻' order by id desc";
DataSet.Open(sql,DataConn,1,1);
//是否有数据
if ((DataSet.eof)&&(DataSet.bof))
{
Response.Write("
" );
Response.Write("=== 暂无 ===");
Response.Write("
");
Response.End();
}
//记录总数
NumRecords=DataSet.RecordCount;
//设定每页最大记录数
PageSize=3;
//总页数
NumPages=Math.ceil(NumRecords/PageSize);
//当前页
i=Request.QueryString("CurrentPageID").Count;
if (i==0)
{
CurrentPageID=1;
}
else
{
CurrentPageID=parseInt(Request.QueryString("CurrentPageID"));
}
//初始化
PreviousPageID=CurrentPageID-1;
NextPageID=CurrentPageID+1;
HomePage=1;
EndPage=NumPages;
//内容列表
DataSet.MoveFirst;
DataSet.Move((CurrentPageID-1)*PageSize,1);
while (!DataSet.eof && j
Response.Write(""+DataSet("subject")+"
");
j=j+1;
DataSet.MoveNext;
}
//设定URL
if (CurrentPageID == HomePage)
{
Response.Write("
首页 ");
Response.Write("上一页 ");
Response.Write("下一页 ");
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20