滚动一行停顿2秒,再滚动下一行--链接数据库写法
这种滚动在静态页面中的写法,详见看 https://yangjunwei.com/26.html
下面是连接数据库写法:
<!--#include file="conn.asp"--> <% Seasql="select * from tab1" set Sears=server.createobject("adodb.recordset") Sears.open Seasql,conn,1,1 if Sears.eof and Sears.bof then response.Write("Nothing!!") else %> <div style="OVERFLOW: hidden;HEIGHT: 22px"> <div id="marqueebox" style="COLOR:#999999; LINE-HEIGHT:22px"> <% for i=1 to Sears.recordcount %> <font style="font-size:14px; font-weight:bolder"><%=Sears("name")%> <%=Sears("address")%></font><br> <% Sears.movenext if Sears.eof then exit for next end if Sears.close:set Sears=nothing %> </div> </div> <script> function startmarquee(lh,speed,delay) { var p=false; var t; var o=document.getElementById("marqueebox"); o.innerHTML+=o.innerHTML; o.style.marginTop=0; o.onmouseover=function(){p=true;} o.onmouseout=function(){p=false;} function start(){ t=setInterval(scrolling,speed); if(!p) o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; } function scrolling(){ if(parseInt(o.style.marginTop)%lh!=0){ o.style.marginTop=parseInt(o.style.marginTop)-1+"px"; if(Math.abs(parseInt(o.style.marginTop))>=o.scrollHeight/2) o.style.marginTop=0; }else{ clearInterval(t); setTimeout(start,delay); } } setTimeout(start,delay); } startmarquee(22,20,2000); </script>