| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 643 人关注过本帖
标题:[求助]滚动的问题
只看楼主 加入收藏
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
 问题点数:0 回复次数:10 
[求助]滚动的问题

下面的这代码是实现滚动的,但每多出一个记录就会多出一个表格,请问应该怎样才能把所有显示的记录都在一个表格中显示呢??/谢谢 ~~~
<!--#include file="../inc/conn_other.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style3 { color: #000000;
font-size: 9px;
}
.style4 {color: #000000}
-->
</style>
<link href="../../css/1.css" rel="stylesheet" type="text/css">
<link href="../../css/2.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-image: url(../../images/bg1111.gif);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<p>



<%
set rs=server.createobject("adodb.recordset")
sql="select * from News where news_type='3' order by News_Date DESC"
rs.open sql,conn,1,1
%>

<table width="201" height="15%" border="0" align="center" cellpadding="0" cellspacing="0">
<% if rs.eof then %>
<tr>
<td width="357" height="20"><div align="center" class="text"><font size="3">暂时没有新闻!!!</font></div></td>
</tr>
<%
else
rs.pagesize=8
totalrecord=rs.recordcount
totalpages=rs.pagecount
maxpages=rs.pagesize
if thepage<1 then
thepage=1
end if
if thepage>totalpages then
thepage=totalpages
end if
if thepage=1 then
showContent
else
if (thepage-1)*maxpages<totalrecord then
rs.move (thepage-1)*maxpages
dim bookmark
bookmark=rs.bookmark
showContent
end if
end if
rs.close
end if

sub showContent
dim i
dim k
k=(totalrecord-maxpages*(thepage-1))+1
i=0
do while not (rs.eof or err)
k=k-1
%>
<tr>
<td height="95" class="text">
<div align="left">
<p>
<marquee direction="up" onMouseOut="this.start()" onMouseOver="this.stop()" scrollamount=3 scrolldelay=100 height=100 width=100>
<a href="../news/News.asp?id=<%=rs("news_id")%>" target="_blank">
<%=left((rs.Fields.Item("News_Title").Value),12)%></a>
                   </marquee>
</p>
 
</div></td>
</tr>
<%
i=i+1
if i>=Maxpages then exit do
rs.Movenext
loop
end sub
%>
</table>


<%
set rs=nothing
conn.close
set conn=nothing
%>
</p>
</body>

搜索更多相关主题的帖子: 滚动 
2006-11-22 10:00
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
大家帮帮忙呀~~

2006-11-22 10:11
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
怎么没人帮我解答一下??
急死了...

2006-11-22 11:30
seal520_2008
Rank: 1
等 级:新手上路
帖 子:239
专家分:0
注 册:2006-6-13
收藏
得分:0 
循环放到 <div align="left">
<p>
<marquee direction="up" onMouseOut="this.start()" onMouseOver="this.stop()" scrollamount=3 scrolldelay=100 height=100 width=100>
<a href="../news/News.asp?id=<%=rs("news_id")%>" target="_blank">
<%=left((rs.Fields.Item("News_Title").Value),12)%></a>
                   </marquee>
</p>
 
</div>

前面

每晚0:00上线 msn:seal520_2008@ myblog:http://seal.
2006-11-22 11:49
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
放前面就出现页面打不开了 ,怎么回事???谢谢

2006-11-22 14:21
seal520_2008
Rank: 1
等 级:新手上路
帖 子:239
专家分:0
注 册:2006-6-13
收藏
得分:0 
我说错了 你哪些需要循环的就循环 tr td不必循环

唉 讲不清楚了 表达能力差 见谅

每晚0:00上线 msn:seal520_2008@ myblog:http://seal.
2006-11-22 14:30
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
谢谢帮忙

能把上面的代码帮我改一下,我再测试看看吗?

2006-11-22 14:36
seal520_2008
Rank: 1
等 级:新手上路
帖 子:239
专家分:0
注 册:2006-6-13
收藏
得分:0 
<!--#include file="../inc/conn_other.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.style3 { color: #000000;
font-size: 9px;
}
.style4 {color: #000000}
-->
</style>
<link href="../../css/1.css" rel="stylesheet" type="text/css">
<link href="../../css/2.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-image: url(../../images/bg1111.gif);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<p>



<%
set rs=server.createobject("adodb.recordset")
sql="select * from News where news_type='3' order by News_Date DESC"
rs.open sql,conn,1,1
%>

<table width="201" height="15%" border="0" align="center" cellpadding="0" cellspacing="0">
<% if rs.eof then %>
<tr>
<td width="357" height="20"><div align="center" class="text"><font size="3">暂时没有新闻!!!</font></div></td>
</tr>
<%
else
rs.pagesize=8
totalrecord=rs.recordcount
totalpages=rs.pagecount
maxpages=rs.pagesize
if thepage<1 then
thepage=1
end if
if thepage>totalpages then
thepage=totalpages
end if
if thepage=1 then
showContent
else
if (thepage-1)*maxpages<totalrecord then
rs.move (thepage-1)*maxpages
dim bookmark
bookmark=rs.bookmark
showContent
end if
end if
rs.close
end if

sub showContent
dim i
dim k
k=(totalrecord-maxpages*(thepage-1))+1
i=0
%>
<tr>
<td height="95" class="text">
<div align="left">
<p>
<marquee direction="up" onMouseOut="this.start()" onMouseOver="this.stop()" scrollamount=3 scrolldelay=100 height=100 width=100>
<%
do while not (rs.eof or err)
k=k-1
%>

<a href="../news/News.asp?id=<%=rs("news_id")%>" target="_blank">
<%=left((rs.Fields.Item("News_Title").Value),12)%></a>
<%
i=i+1
if i>=Maxpages then exit do
rs.Movenext
loop
end sub
%>
                   </marquee>
</p>
 
</div></td>
</tr>
</table>


<%
set rs=nothing
conn.close
set conn=nothing
%>
</p>
</body>

这样看看行不行

每晚0:00上线 msn:seal520_2008@ myblog:http://seal.
2006-11-22 14:47
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
这样做所有记录就成一行显示滚动了
我加上<br>看行不行

2006-11-22 14:49
yfen258
Rank: 1
等 级:新手上路
帖 子:266
专家分:0
注 册:2006-3-31
收藏
得分:0 
可以了
谢谢你啊

2006-11-22 14:51
快速回复:[求助]滚动的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012685 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved