中文(繁体)
<HTML> <HEAD> <title>多段文字多行逐段單一出現的特效</title> <script language=JAVAscript> <!-- // ------ 定義全域變數var theNewsNum; var theAddNum; var totalNum; var CurrentPosion=0; var theCurrentNews; var theCurrentLength; var theNewsText; var theTargetLink; var theCharacterTimeout; var theNewsTimeout; var theBrowserVersion; var theWidgetOne; var theWidgetTwocker var theBrowserVersion; var theWidgetOne; var theWidgetTwocker var theBrowserString the No. / ------ 設定初始數值theCharacterTimeout = 50;//字元間隔時間theNewsTimeout = 2000;//新聞間隔時間theWidgetOne = "_";//新聞前面下標1 theWidgetTwo = "-";//新聞前面下標theNewsState = 1; //theNewsNum = document.body.children.incoming.children.NewsNum.innerText;//新聞總條數//add by lin theNewsNum = document.getElementById("incoming").children .AllNews.children.length;//新聞總條數theAddNum = document.getElementById("incoming").children.AddNews.children.length;//補充條數totalNum =theNewsNum+theAddNum; theCurrentNews = 0; theCurrentLength = 0; theCurrentNews ; theLeadString = " "; theSpaceFiller = " "; runTheTicker(); } // --- 基礎函數function runTheTicker() { if(theNewsState == 1) { if(CurrentPosion<theNewsNum){ setupNextNews(); } else{ setupAddNews(); } CurrentPosion++; if(CurrentPosion>=totalNum||CurrentPosion>=5) CurrentPosion=0; //最多條數不超過5條} if(theCurrentLength != theNewsText.length) { drawNews(); } else { closeOutNews(); } } //more javascript from http://www.downcodes.com // --- 跳到下一則新聞function setupNextNews() { theNewsState = 0; theCurrentNews = theCurrentNews % theNewsNum; theNewsText = document. getElementById("AllNews").children[theCurrentNews].children.Summary.innerText; theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.NewsLink.innerText; theCurrentLength = 00hotum. href = theTargetLink; theCurrentNews++; } function setupAddNews() { theNewsState = 0; theCurrentNews = theCurrentNews % theAddNum; theNewsText = document.getElementById("incoming").children.AddNews.children[theCurrentNews....ren.o. document.getElementById("incoming").children.AddNews.children[theCurrentNews].children.NewsLink.innerText; theCurrentLength = 0; document.all.hottext.href = theTargetLink; theCurrentNews++; } // --- News () { var myWidget; if((theCurrentLength % 2) == 1) { myWidget = theWidgetOne; } else { myWidget = theWidgetTwo; } document.all.hottext.innerHTML = theLeadString + theNewsAstring(Ladength) + theSpaceFiller; theCurrentLength++; setTimeout("runTheTicker()", theCharacterTimeout); } // --- 結束新聞循環function closeOutNews() { document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller; "runTheTicker()", theNewsTimeout); } window.onload=startTicker; //--> </script> </HEAD> <BODY> <table> <tr><td> <div id=visible>建站學院快報:<a href="" id=hottext target="_blank"></a></div> </td></tr> </table> <div id=incoming style="DISPLAY: none"> < div id=AllNews> <div id=1> <div id=Summary>全國政協代表團出訪三國出席經社理事會會議</div> <div id=NewsLink>#</div> </div> <div id=2> <div id=Summary>[東方時空]六天七夜降服森林大火</div> <div id=NewsLink>#</div> </div> <div id=3> <div id=Summary >香港特區政府就曾蔭權請辭政務司司長發表聲明</div> <div id=NewsLink>#</div> </div> <div id=4> <div id=Summary>劉雲山會見寮國客人< /div> <div id=NewsLink>#</div> </div> <div id=5> <div id=Summary>曾慶紅強調先進性教育活動要自始至終注重實效</div> <div id=NewsLink> #</div> </div> </div> <div id=AddNews> </div> </div>