主题:高手帮我解释一下这些代码(希望详细点,本人是新手)
<!--#include file="../inc/conn.asp" -->
<%
sql="select innerid,title,newstime from news order by newstime desc"
set rs=server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,1
if rs.eof then
response.Write "<center><br><br><br><br><br><br><font color='red'><li>暂时没有任何新闻!<br><br>请您先<a href='./newsadd.asp'><u>新增新闻</u><a></font></center>"
response.End
else
rs.PageSize =20 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
i=0
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻在线</title>
<link href="../css/style.css" rel="stylesheet" type="text/css"> //连接后台数据库
</head>
<body>
<center>
<table width="777" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><!--#include file="../inc/head.asp" --></td>
</tr><!--#include file="../inc/conn.asp" -->
<tr>
<td width="121">
<table width="121" height="480" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td height="46"><img src="../images/news-1.jpg" width="121" height="46"></td>
</tr>
<tr valign="top">
<td background="../images/ppp-1.jpg"> <div align="center"> </div></td>
</tr>
<tr valign="top">
<td height="21" background="../images/ppp-2.jpg"> </td>
</tr>
</table>
</td>
<td width="656" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7%" height="45"> </td>
<td width="93%"> </td>
</tr>
</table>
<% do while not rs.eof and i<rs.pagesize
i=i+1%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7%" height="25"><div align="center"><img src="../images/point.gif" width="9" height="21"></div></td>
<td width="93%"><a href="../asp/onlinenews.asp?innerid=<%=rs("innerid")%>"><%=rs("title")%></a> 发布时间:<%=rs("newstime")%></td>
</tr>
</table>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="24"><div align="center">共<font color=red><%=maxpage%></font>页
第<%=page%>页 <font color=666666>
<%if page-1>0 then%>
<a href="news.asp?page=<%=page-1%>">上一页</a>
<%else%>
<font color=666666>上一页</font>
<%end if%>
<%if page+1<=maxpage then%>
<a href="news.asp?page=<%=page+1%>">下一页</a>
<%else%>
<font color=666666>下一页</font>
<%end if%>
</font>共 <%=iCount %> 条记录</div></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="2"><!--#include file="../inc/foot.asp" --></td>
</tr>
</table>
<!--#include file="../inc/close.asp" -->
</center>
</body>
</html>
<%
sql="select innerid,title,newstime from news order by newstime desc"
set rs=server.CreateObject("adodb.recordset")
rs.Open sql,conn,1,1
if rs.eof then
response.Write "<center><br><br><br><br><br><br><font color='red'><li>暂时没有任何新闻!<br><br>请您先<a href='./newsadd.asp'><u>新增新闻</u><a></font></center>"
response.End
else
rs.PageSize =20 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")
if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if
if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if
rs.AbsolutePage=Page
if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
i=0
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新闻在线</title>
<link href="../css/style.css" rel="stylesheet" type="text/css"> //连接后台数据库
</head>
<body>
<center>
<table width="777" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><!--#include file="../inc/head.asp" --></td>
</tr><!--#include file="../inc/conn.asp" -->
<tr>
<td width="121">
<table width="121" height="480" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td height="46"><img src="../images/news-1.jpg" width="121" height="46"></td>
</tr>
<tr valign="top">
<td background="../images/ppp-1.jpg"> <div align="center"> </div></td>
</tr>
<tr valign="top">
<td height="21" background="../images/ppp-2.jpg"> </td>
</tr>
</table>
</td>
<td width="656" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7%" height="45"> </td>
<td width="93%"> </td>
</tr>
</table>
<% do while not rs.eof and i<rs.pagesize
i=i+1%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7%" height="25"><div align="center"><img src="../images/point.gif" width="9" height="21"></div></td>
<td width="93%"><a href="../asp/onlinenews.asp?innerid=<%=rs("innerid")%>"><%=rs("title")%></a> 发布时间:<%=rs("newstime")%></td>
</tr>
</table>
<%
rs.movenext
loop
rs.close
set rs=nothing
%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="24"><div align="center">共<font color=red><%=maxpage%></font>页
第<%=page%>页 <font color=666666>
<%if page-1>0 then%>
<a href="news.asp?page=<%=page-1%>">上一页</a>
<%else%>
<font color=666666>上一页</font>
<%end if%>
<%if page+1<=maxpage then%>
<a href="news.asp?page=<%=page+1%>">下一页</a>
<%else%>
<font color=666666>下一页</font>
<%end if%>
</font>共 <%=iCount %> 条记录</div></td>
</tr>
</table> </td>
</tr>
<tr>
<td colspan="2"><!--#include file="../inc/foot.asp" --></td>
</tr>
</table>
<!--#include file="../inc/close.asp" -->
</center>
</body>
</html>