• Register

滚动一行停顿2秒,再滚动下一行--链接数据库写法

这种滚动在静态页面中的写法,详见看 http://yangjunwei.com/a/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>
版权声明:转载请注明来自杨俊伟博客,本文地址:http://yangjunwei.com/a/148.html
除非注明,杨俊伟博客文章均为原创,转载请注明出处和链接!
 

Comments are closed.

评论已关闭

我还是想用邮箱注册

登录

忘记密码 ?

用第三方帐号快捷登录

已有账户?前往登录吧~

注册