网页打字机效果,用于新闻标题.数据库动态.
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>
<!--打字机效果出现文字,带相应连接,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>
相关文章推荐
- 网页打字机效果,用于新闻标题.数据库动态.
- 网页打字机效果,用于新闻标题.数据库动态.
- 网页打字机效果,用于新闻标题.数据库动态.
- DynamicMakeBean.java 这是一个servlet 用于动态产生网页
- 用hover配合position(纯css)实现网页动态效果
- ASP入门-dreamweaver CS6+IIS怎样运行动态网页和连接数据库
- JS动态实现遮盖网页效果
- python网络爬虫抓取动态网页并将数据存入数据库MySQL
- 动态文本里显示网页字体效果
- 网页上TextBox动态文字效果(javascript)
- 网页常用动态效果--优酷轮播图
- 使用css设置网页元素的动态效果(如鼠标经过)
- 简单的动态网页设计及开发(关联数据库)
- 网页常用动态效果--网易轮播图
- 写COM组件用于ASP/PHP等动态网页
- JS图片幻灯片效果与数据库链接的动态(两种)
- jquery版网页倒计时动态效果
- 动态网页中数据库的连接代码
- 关于网页制作的一些动态效果