求连续不间断向上滚动图片的代码(可访问数据库)

lingzp 2004-11-30 09:16:00
用Maqueen的方式总有一段时间的间隔,不间断的代码又往往不能访问数据库,请高手赐教!!
...全文
453 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zlj113 2004-12-06
  • 打赏
  • 举报
回复
<%
Dim Conn,connstr
connstr="DBQ="+server.mappath("my_code/database/My_code.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.open connstr

%><div id="marquees">
<%set rs=server.createobject("adodb.recordset")
sql="select * from code"
rs.open sql,conn,1,1
do while not rs.eof
%>
<a href="javascript:"><% = rs("code_title") %></a><br>
<br>
<%rs.movenext
loop%>
</div>
<script language="JavaScript">

marqueesHeight=200;
stopscroll=false;

with(marquees){
style.width=0;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=true;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
document.write('<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');

preTop=0; currentTop=0;

function init(){
templayer.innerHTML="";
while(templayer.offsetHeight<marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
setInterval("scrollUp()",20);//越大越慢
}
document.body.onload=init;

function scrollUp(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
marquees.scrollTop+=1;
}
}
</script>




danjingwu 2004-12-06
  • 打赏
  • 举报
回复
代码有点多,呵呵!!!
danjingwu 2004-12-06
  • 打赏
  • 举报
回复
<SCRIPT language=javascript>
<!--
function window.onload() { setTimeout("fillup()",800); }

var sliderwidth=300;
var sliderheight=1130;
var slidespeed=2;
var slidebgcolor='#999999';

var leftrightslide=new Array();
var finalslide='';

var copyspeed=slidespeed;
var iedom=document.all||document.getElementById;
var actualheight='';
var cross_slide, ns_slide;

function fillup(){
if (iedom){
cross_slide=document.getElementById("_slide2");
cross_slide2=document.getElementById("_slide3");
actualheight=cross_slide.offsetHeight;
cross_slide2.style.top=actualheight;
}
else{
alert("请用IE6.0浏览本站!");
}
directionTime=setInterval("slidetop()",40);
}

function slidetop(){
if (iedom){
if (parseInt(cross_slide.style.top)>(actualheight*(-1)))
cross_slide.style.top=parseInt(cross_slide.style.top)-copyspeed;
else
cross_slide.style.top=parseInt(cross_slide2.style.top)+actualheight-3;

if (parseInt(cross_slide2.style.top)>(actualheight*(-1)))
cross_slide2.style.top=parseInt(cross_slide2.style.top)-copyspeed;
else
cross_slide2.style.top=parseInt(cross_slide.style.top)+actualheight-3;
}
else{
alert("请用IE6.0浏览本站!");
}
}
//-->
</SCRIPT>

<%
sql = "select top 15 nickname,u.userid,photo,age,sex,province from userinfo as u,point as p where photo <> '没有相片' and "
sql = sql + "u.userid = p.userid and (photo is null or photo <> ' ') order by sort desc,total desc"
Set rst = conn.Execute(sql)
%>
<div style="Z-INDEX: 2; LEFT: 0px; OVERFLOW: hidden; WIDTH: 300px; POSITION: relative; HEIGHT: 1130px">
<div onMouseOver=copyspeed=0 style="LEFT: 0px; WIDTH: 300px; POSITION: absolute; HEIGHT: 1130px" onMouseOut=copyspeed=slidespeed>
<div id=_slide2 style="Z-INDEX: 2; LEFT: 0px; POSITION: absolute; TOP: 0px">
<table width="300" border="0" cellpadding="0" cellspacing="0">
<%
myi = 1
while not rst.EOF
if myi = 0 then
mycolor = "#90A9E5"
else
mycolor = "#CBD7F3"
end if

userid = Trim(rst("userid"))
photo = Trim(rst("photo"))
nickname = Trim(rst("nickname"))
%>
<tr>
<td height="100">
<table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"><table width="100%" height="100" border="0" cellpadding="0" cellspacing="0" class="indextable">
<tr>
<td bgcolor="<%=mycolor%>"> </td>
</tr>
</table></td>
<td><table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="99"><table width="100%" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100" rowspan="5" align="center"><a href="memberinfo.asp?userid=<%=userid%>" target="_top"><img src="userphoto/<%=photo%>" width="90" height="90" border="0"></a></td>
<td height="25" colspan="2"> </td>
</tr>
<tr>
<td height="25" colspan="2">来自<font color="#FF9900"><%=Trim(rst("province"))%></font>的 <b><a href="memberinfo.asp?userid=<%=userid%>" target="_blank"><%=nickname%></a></b></td>
</tr>
<tr>
<td width="87" height="25">性别:<%=Trim(rst("sex"))%></td>
<td width="87" height="25">年龄:<%=Trim(rst("age"))%></td>
</tr>
<%
sqlindex = "select top 1 title,skim,songid from usersong where userid="&Trim(rst("userid"))&" and title like '%本人推荐%' order by skim desc"
set rs = conn.execute(sqlindex)
if rs.EOF then
sqlindex = "select top 1 title,skim,songid from usersong where userid="&Trim(rst("userid"))&" order by skim desc"
Set rs = conn.Execute(sqlindex)
end if
if not rs.EOF then
title = Trim(rs("title"))
songid = Trim(rs("songid"))
Call CheckLen(title,16)
else
title = "没有歌曲"
songid = ""
end if
rs.Close
%>
<tr>
<td height="25" colspan="2">最红歌曲:<A onclick="MM_openBrWindow('play.asp?songid=<%=songid%>','','width=450,height=350')" href="#"><%=title%></a></td>
</tr>
</table></td>
</tr>
<tr>
<td width="1" bgcolor="#90A9E5"></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<%
rst.movenext
myi = 1 - myi
wend
%>
</table>
</div>
<div id=_slide3 style="Z-INDEX: 1; LEFT: 0px; POSITION: absolute; TOP: 0px">
<table width="300" border="0" cellpadding="0" cellspacing="0">
<%
rst.movefirst
myi = 1
while not rst.EOF
if myi = 0 then
mycolor = "#90A9E5"
else
mycolor = "#CBD7F3"
end if

userid = Trim(rst("userid"))
photo = Trim(rst("photo"))
nickname = Trim(rst("nickname"))
%>
<tr>
<td height="100"><table width="100%" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="10"><table width="100%" height="100" border="0" cellpadding="0" cellspacing="0" class="indextable">
<tr>
<td bgcolor="<%=mycolor%>"> </td>
</tr>
</table></td>
<td><table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="99"><table width="100%" height="100" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100" rowspan="5" align="center"><a href="memberinfo.asp?userid=<%=userid%>" target="_top"><img src="userphoto/<%=photo%>" width="90" height="90" border="0"></a></td>
<td height="25" colspan="2"> </td>
</tr>
<tr>
<td height="25" colspan="2">来自<font color="#FF9900"><%=Trim(rst("province"))%></font>的 <b><a href="memberinfo.asp?userid=<%=userid%>" target="_blank"><%=nickname%></a></b></td>
</tr>
<tr>
<td width="87" height="25">性别:<%=Trim(rst("sex"))%></td>
<td width="87" height="25">年龄:<%=Trim(rst("age"))%></td>
</tr>
<%
sqlindex = "select top 1 title,skim,songid from usersong where userid="&Trim(rst("userid"))&" and title like '%本人推荐%' order by skim desc"
set rs = conn.execute(sqlindex)
if rs.EOF then
sqlindex = "select top 1 title,skim,songid from usersong where userid="&Trim(rst("userid"))&" order by skim desc"
Set rs = conn.Execute(sqlindex)
end if
if not rs.EOF then
title = Trim(rs("title"))
songid = Trim(rs("songid"))
Call CheckLen(title,16)
else
title = "没有歌曲"
songid = ""
end if
rs.Close
%>
<tr>
<td height="25" colspan="2">最红歌曲:<A onclick="MM_openBrWindow('play.asp?songid=<%=songid%>','','width=450,height=350')" href="#"><%=title%></a></td>
</tr>
</table></td>
</tr>
<tr>
<td width="1" bgcolor="#90A9E5"></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<%
rst.movenext
myi = 1 - myi
wend
rst.Close
Set rst = nothing
Set rs = nothing
conn.Close
Set conn = nothing
%>
</table>
</div>
</div>
</div>
David2008 2004-11-30
  • 打赏
  • 举报
回复
不过,我作过这种
当然都是有个 “间断”在里头的
David2008 2004-11-30
  • 打赏
  • 举报
回复
期待解决
我也想知道
o_O800 2004-11-30
  • 打赏
  • 举报
回复
好啊。不错
jnhfly 2004-11-30
  • 打赏
  • 举报
回复
<table width='100%' cellSpacing='5'>
<% set rs4=server.CreateObject("adodb.recordset")
sql="select top 7 * from pub order by ID DESC"
rs4.open sql,conn,1,1
if rs4.eof or rs4.bof then
%>
<font color="#000000">暂无公告</font>
<%
end if
do while not rs4.eof
%>
<TR>
<TD width=340 height=17 valign="top" class=text-0> <img

src="img/bt.gif" width="11" height="9">
<a

href="javascript:OpenWin1('gonggao.asp?id=<%=rs4("id")%>','')"><FONT color="#000000">

<%=left(rs4("title"),32) %></FONT></a><br></TD>
</TR>
<%
rs4.movenext
loop
rs4.close
%>
</table>


你换成图片即可。试用过很多,就这个好
zzs_2013 2004-11-30
  • 打赏
  • 举报
回复
我现在也想要实现这个功能,图片下面还要跟随图片说明

28,390

社区成员

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

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