< %@LANGUAGE="JAVASCRIPT " CODEPAGE="936"%>
<!--#include file="connect.asp"-->
<!--#include file="news.asp"-->
<%
var DataSet,sql,DataList;
var i=0;
var j=0;
DataList=new News();
DataSet=Server.CreateObject("Adodb.recordset");
sql="select * from News where ngroup='Group News' order by id desc";
DataSet.Open(sql,DataConn,1,1);
//Whether there is data
if ((DataSet.eof)&&(DataSet.bof))
{
Response.Write("<BR>" );
Response.Write("=== None===");
Response.Write("<BR><BR>");
Response.End();
}
//Total number of records
NumRecords=DataSet.RecordCount;
//Set the maximum number of records per page
PageSize=3;
//Total number of pages
NumPages=Math.ceil(NumRecords/PageSize);
//Current page
i=Request.QueryString("CurrentPageID").Count;
if (i==0)
{
CurrentPageID=1;
}
else
{
CurrentPageID=parseInt(Request.QueryString("CurrentPageID"));
}
//Initialization
PreviousPageID=CurrentPageID-1;
NextPageID=CurrentPageID+1;
HomePage=1;
EndPage=NumPages;
//Content list
DataSet.MoveFirst;
DataSet.Move((CurrentPageID-1)*PageSize,1);
while (!DataSet.eof && j<PageSize)
{
Response.Write("<a href=show.asp?id="+DataSet("id")+" target="_blank">"+DataSet("subject")+"</a><br> ");
j=j+1;
DataSet.MoveNext;
}
//Set URL
if (CurrentPageID == HomePage)
{
Response.Write("<p class='Normal'><a href=list.asp?CurrentPageID="+HomePage+">Homepage</a> ");
Response.Write("Previous page ");
Response.Write("<a href=list.asp?CurrentPageID="+NextPageID+">Next page</a> ");
Response.Write("<a href=list.asp?CurrentPageID="+EndPage+">Last page</a> </p>");
}
else if (CurrentPageID == EndPage)
{
Response.Write("<p class='Normal'><a href=list.asp?CurrentPageID="+HomePage+">Homepage</a> ");
Response.Write("<a href=list.asp?CurrentPageID="+PreviousPageID+">Previous page</a> ");
Response.Write("Next page ");
Response.Write("<a href=list.asp?CurrentPageID="+EndPage+">Last page</a> </p>");
}
else
{
Response.Write("<p class='Normal'><a href=list.asp?CurrentPageID="+HomePage+">Homepage</a> ");
Response.Write("<a href=list.asp?CurrentPageID="+PreviousPageID+">Previous page</a> ");
Response.Write("<a href=list.asp?CurrentPageID="+NextPageID+">Next page</a> ");
Response.Write("<a href=list.asp?CurrentPageID="+EndPage+">Last page</a> </p>");
}
%>