这下面的程序是我写的分页,可是不知为什么ie执行不了,请问各位高手给指点一下错误!

cwjdily 2003-10-16 02:07:01
各位我知程序长,请大家耐心看看,给我说说错误,我很急,谢谢帮忙了,另外问一下,分页是不是还要给数据库里加什么栏位吗?谢谢!





<% @language="vbscript" %>
<!-- #INCLUDE FILE="conn.asp" -->

<%
'response.buffer=true
'Response.Expires=0
'sql="select * from news where news_native='"&request("native")&"' order by news_date"
'Set rs = Server.CreateObject("ADODB.Recordset")

'rs.open sql,conn,3
%>



<%
response.buffer=true
Response.Expires=0
sql="select * from news where news_native='"&request("native")&"' order by news_date"
Set rs = Server.CreateObject("ADODB.Recordset")

rs.open sql,conn,1

page=1
rs.PageSize = 20

if Not IsEmpty(Request("Page")) then

Page = CInt(Request("Page"))

if Page > rst.PageCount then
rst.AbsolutePage = rst.PageCount

elseif Page <= 0 then
Page = 1
else
rs.AbsolutePage = Page
end if
End if
intCurPage = rsj.AbsolutePage
%>
<%

For i = 1 to rs.PageSize
if rst.eOF then
Exit For
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>新闻条目</title>
<style TYPE="text/css">
<!--
.p9 { font-family: "宋体"; font-size: 9pt; font-weight: normal}
.p9e { font-family: "arial"; font-size: 9pt; font-weight: normal}
.p92 { font-size: 9pt; line-height: 15pt}
a:link { text-decoration: none}
a:visited { text-decoration: none}
a:hover { color: #3880DE}
.p12 { font-family: "宋体"; font-size: 9pt; line-height: 18pt; text-decoration: underline}
.p11 { font-size: 11pt}
.p11-150 { font-size: 11pt; line-height: 150%}
.p9-150 { font-size: 9pt; line-height: 150%; text-decoration: none}
-->
</style>
</head>
<body bgColor="#ffffff" topMargin="0" link="#2F4F4F" vlink="#2F4F4F" alink="#2F4F4F" text="#808080" leftmargin="0" marginwidth="0" marginheight="0">
<div align="center">
<center>
<table width=778 border=0 cellpadding=0 cellspacing=0>
<tr>
<td> <img src="images/top_01.jpg" width=78 height=84></td>
<td> <img src="images/top_02.jpg" width=78 height=84></td>
<td> <img src="images/top_03.jpg" width=77 height=84></td>
<td> <img src="images/top_04.jpg" width=78 height=84></td>
<td> <img src="images/top_05.jpg" width=78 height=84></td>
<td> <img src="images/top_06.jpg" width=78 height=84></td>
<td> <img src="images/top_07.jpg" width=78 height=84></td>
<td> <img src="images/top_08.jpg" width=77 height=84></td>
<td> <img src="images/top_09.jpg" width=78 height=84></td>
<td> <img src="images/top_10.jpg" width=78 height=84></td>
</tr>
</table>
<table width="778" border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="images/bg.jpg" width="230" rowspan="2"> </td>
<td> </td>
</tr>
<tr>
<td align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="p9-150"> <font color=#FF9933> <b> </b></font>
<div align="left"><font color="#000000"><span class=txt> </span><br>
<%
if not rs.eof then
rs.movelast
do while not rs.Bof
是头条新闻吗?
if trim(rs("news_native"))=request("native") then
'判断是否news_comment中提供了新闻内容
%>
<img src="images/pot.gif" width="17" height="13">  <font
class="p9-200"><%=rs("news_date")%></font>  <a
href="disp.asp?recno=<%=rs("news_no")%>" target="news"><%=rs("news_title")%></a>
<br>
<%
' end if
'rs.moveprevious
'loop
'end if
%>

<%rs.movenxet
next
%>
<%if page<>1 then%><a Href="nesw2.asp?Page=<% = 1%>">首页</a> <a Href="nesw2.asp?ToPage=<% =ToPage -1 %>">上一页</a> %><%end if %><%if page<>rs.pagecount then %><a Href="nesw2.asp?ToPage=<% =Page + 1%>">下一页</a> <a Href="nesw2.asp?ToPage=<% = rs.PageCount%>">尾页</a> <% end if %>

</font></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</div>
<center>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="p9">CopyRight © 2000 ChinaGoldCoin.net <span class="p9"><a href="mailto:webmaster@chinagoldcoin.net">Email:webmaster@chinagoldcoin.net</a></span></td>
</tr>
</table>
</center>
</body>
</html>
<script language="JavaScript">
function news()
{

window.open("temp.htm","news","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,top=2,left=2,width=500,height=500")
//window.open("1.htm","news","width=470,height=500");

}
</script>
<%
rst.close
Set rs = Nothing
conn.close
set conn=nothing
%>
...全文
41 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenmei 2003-10-16
  • 打赏
  • 举报
回复
分页是不是还要给数据库里加什么栏位吗?
不需要
yoyo133 2003-10-16
  • 打赏
  • 举报
回复
dreamwear MX上有现成的组件

我给你提供以下分页代码:
<!-- #INCLUDE FILE="conn.asp" -->

<%
response.buffer=true
Response.Expires=0
sql="select * from news where news_native='"&request("native")&"' order by news_date"
Set rs = Server.CreateObject("ADODB.Recordset")

rs.open sql,conn,1

page=1
rs.PageSize = 20

if Not IsEmpty(Request("Page")) then

Page = CInt(Request("Page"))

if Page > rs.PageCount then
rs.AbsolutePage = rs.PageCount

elseif Page <= 0 then
Page = 1
else
rs.AbsolutePage = Page
end if
End if
intCurPage = rsj.AbsolutePage
%>
<body>
<%if page<>1 then%>
<a Href="nesw2.asp?Page=<% = 1%>">首页</a>
<a Href="nesw2.asp?Page=<% =Page -1 %>">上一页</a>
<%end if %>
<%if page<>rs.pagecount then %>
<a Href="nesw2.asp?Page=<% =Page + 1%>">下一页</a>
<a Href="nesw2.asp?Page=<% = rs.PageCount%>">尾页</a>
<% end if %>
<hr>
<%
For i = 1 to rs.PageSize
if rs.eOF then
Exit For
end if
%>
<%=rs("news_title")%>
<%rs.movenxet
next
%>
</body>


chenmei 2003-10-16
  • 打赏
  • 举报
回复
<a Href="nesw2.asp?ToPage=<% =ToPage -1 %>">
这里错了吧
lovehwq21 2003-10-16
  • 打赏
  • 举报
回复
你怎么一时用rst,一时用rsj,一时用rs,统一用一个才行啊
say1no2 2003-10-16
  • 打赏
  • 举报
回复
<a Href="nesw2.asp?ToPage=<% =ToPage -1 %>">这里的参数名错了
把topage改成page
pp4u 2003-10-16
  • 打赏
  • 举报
回复
把<a Href="nesw2.asp?ToPage=<% =ToPage -1 %>">
改为
<a Href="nesw2.asp?page=<% =intCurPage -1 %>">
第一个topage改为page
第二个toPage改为intcurpage

其他地方类似.
cwjdily 2003-10-16
  • 打赏
  • 举报
回复
帮帮忙吧

28,390

社区成员

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

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