<%dim adstr_word,adstr_link,adnum
sql="select * from ad_news where C_flag=0 order by tim desc"
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof or rs.bof then
adstr_word[0]="暫時沒有"
adstr_link[0]="http://www.366golf.com"
adnum=0
else
adnum=rs.recordcount
Redim adstr_word(adnum+1)
Redim adstr_link(adnum+1)
k=0
do while not rs.eof
adstr_word(k)=rs("word")
adstr_link(k)=rs("link")
k=k+1
rs.movenext
loop
rs.close
end if
%>
var NewsTime = 3500;
var TextTime = 40;
var newsi = 0;
var txti = 0;
var txttimer;
var newstimer;
var newstitle = new Array();
var newshref = new Array();
<%for k=0 to adnum%>
newstitle[<%=k%>]="<%=adstr_word(k)%>";
newshref[<%=k%>]="<%=adstr_link(k)%>";
<%next%>
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").target="_blank";
document.getElementById("printWord").innerHTML = hwnewstr.substring(0,txti+1)+endstr;
txti++;
txttimer = setInterval("shownews()",TextTime);
}
shownews();
更多信息請查看IT技術(shù)專欄