向左滚动:
<DIV id=mhmove style="OVERFLOW: hidden; WIDTH: 440px">
<TABLE width="440" border=0 align=center cellPadding=0 cellspace="0">
<TBODY>
<TR>
<TD width="440" vAlign=top id=mhmove1>
<TABLE borderColor=#111111
cellSpacing=0 borderColorDark=#c0c0c0 cellPadding=2
width="98%" align=center borderColorLight=#c0c0c0 border=0>
<TBODY>
<TR align=middle>
<%'数据库链接省略...
'这里是从数据库读取产品图片来显示---------------------------------------------
exce="select * from system2"
Set fl = Server.CreateObject("ADODB.RecordSet")
fl.Open exce,conn,1,1
did=fl("w5")
exce="select * from L_cp order by xh asc"
'exce="select * from L_cp where did="&did&" order by time desc"
Set rs8= Server.CreateObject("ADODB.RecordSet")
rs8.Open exce,conn,1,1
do while not rs8.eof
i=i+1%> <TD>
<table width="90" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="90" background="img/index_cp.jpg"><table width="105" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="90" ><div align="center"><a href="products.asp?id=<%=rs8("id")%>&fangda=yes"><img src="<%if len(rs8("img2"))>6 then%>wzgl/<%=rs8("img2")%><%else%>wzgl/bimg/null.jpg<%end if%>" alt="" name="tu" height=80 border="1" style="border-color:#E8E8E8"></a></div></td>
</tr>
</table></td>
</tr>
</table>
</TD> <%if i=8 then exit do
rs8.movenext
loop
rs8.close
set rs8=nothing
%>
<%'完毕---------------------------------------------------------------------------------------%>
</TR></TBODY></TABLE></TD>
<TD width="30" id=mhmove2></TD>
</TR></TBODY></TABLE> </DIV>
<SCRIPT>
var speed=1
mhmove2.innerHTML=mhmove1.innerHTML
function Marquee3(){
if(mhmove2.offsetWidth-mhmove.scrollLeft<=0)
mhmove.scrollLeft-=mhmove1.offsetWidth
else{
mhmove.scrollLeft++
}
}
var MyMar2=setInterval(Marquee3,speed)
mhmove.onmouseover=function() {clearInterval(MyMar2)}
mhmove.onmouseout=function() {MyMar2=setInterval(Marquee3,speed)}
</SCRIPT>
向上滚动:
<DIV id=demo
style="OVERFLOW: hidden; WIDTH: 260px; COLOR: #000000; HEIGHT: 130px">
<DIV id=demo1>
<TABLE height=83 cellSpacing=0 cellPadding=0 width=196 border=0>
<TBODY>
<TR>
<TD background="">
<TABLE height=392 cellSpacing=0 cellPadding=0 width=192
border=0>
<TBODY>
<%'数据库链接省略...
'这里是从数据库读取产品图片来显示---------------------------------------------
exce="select * from l_cp order by time desc"
Set rsimg= Server.CreateObject("ADODB.RecordSet")
rsimg.Open exce,conn,1,1
do while not rsimg.eof
iw=iw+1
%>
<TR>
<TD align=middle height=13><font color="#ffffff"><%=rsimg("mc")%></font></TD></TR><TR>
<TR>
<TD align=middle height=83><a href="products.asp?id=<%=rsimg("id")%>&fangda=yes"><img src="wzgl/<%=rsimg("img2")%>" alt="" name="tu" width="130" height="166" border="0" ></a></TD></TR><TR>
<TR>
<TD align=middle height=13></TD></TR><TR>
<%if iw=10 then exit do
rsimg.movenext
loop
rsimg.close
set rsimg=nothing
%>
</TBODY></TABLE></TD></TR></TBODY></TABLE></DIV>
<DIV id=demo2 ></DIV></DIV>
<SCRIPT>
var speed=30
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetTop-demo.scrollTop<=0)
demo.scrollTop-=demo1.offsetHeight
else{
demo.scrollTop++
}
}
var MyMar=setInterval(Marquee,speed)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
</SCRIPT>
以上是滚动模型,使用时请修改相应代码!特别是asp代码<%%>部分,你可以去掉,将里面的代码复制几份即是静态滚动了!
本文介绍了一种使用ASP结合HTML和JavaScript实现的动态滚动效果,包括向左滚动的产品展示和向上滚动的文字内容。通过从数据库中读取数据并动态生成页面元素来实现内容的连续滚动。
2492

被折叠的 条评论
为什么被折叠?



