您的位置:首页 > 数据库

网页打字机效果,用于新闻标题.数据库动态.

2006-10-15 19:11 316 查看
数据库结构仍然同我之前发的为同一个

<!--打字机效果出现文字,带相应连接,FIREFOX不支持-->
<!--#include file="inc/conn.asp"-->
<style type="text/css">
<!--
#hotNews{ margin:0 auto; width:471px; height:24px; background:#f6f6f6; border-top:1px solid #000; border-bottom:1px solid #000;}
#hotNews h2{float:left; padding:6px 0 0 6px; font-size:12px; font-weight:normal;color:#bc2931;}
#hotNews a{color:#bc2931;}
#hotNews a:hover{color:#000;}
#hotNews_new{ margin:0 auto; width:471px; overflow:hidden; height:24px; background:#f6f6f6; border-top:1px solid #000; border-bottom:1px solid #000;}
#hotNews_new h5{float:left; padding:6px 0 0 6px; font-size:12px; font-weight:normal;color:#bc2931;}
#hotNews_new h6{float:left; text-align:left; padding:6px 0 0 4px; overflow:hidden; width:330px; font-size:12px; font-weight:normal;color:#bc2931;}
#hotNews_new span{float:right; padding:6px 8px 0 0; width:75px;}
#hotNews_new a{color:#bc2931;}
#hotNews_new a:hover{color:#000;}

-->
</style>
<DIV id=hotNews_new><H6>·<A id=printWord href=""></A></H6>
<%Set rs=Server.CreateObject("ADODB.Recordset")
sql="select top 6 * from product order by updatetime desc"
rs.open sql,conn,1,1%>
<SCRIPT language=JavaScript>
var NewsTime = 3500;
var TextTime = 20;
var newsi = 0;
var txti = 0;
var txttimer;
var newstimer;
var newstitle = new Array();
var newshref = new Array();
<%i=-1'因为要从0计数
do while not rs.eof
i=i+1
%>
newstitle[<%=i%>] = "<%=rs("title")%>";
newshref[<%=i%>] = "productshow.asp?articleid=<%=rs("articleid")%>";
<%rs.movenext
loop%>

function shownews()
{
var endstr = "_"
hwnewstr = newstitle[newsi];
newslink = newshref[newsi];
if(txti==(hwnewstr.length-1)){endstr="";}
if(txti>=hwnewstr.length){
clearInterval(txttimer);
clearInterval(newstimer);
newsi++;
if(newsi>=newstitle.length){
newsi = 0
}
newstimer = setInterval("shownews()",NewsTime);
txti = 0;
return;
}
clearInterval(txttimer);
document.getElementById("printWord").href=newslink;
document.getElementById("printWord").innerHTML = hwnewstr.substring(0,txti+1)+endstr;
txti++;
txttimer = setInterval("shownews()",TextTime);
}
shownews();
</SCRIPT>
</div>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: