單行滾動向上新聞特效待碼+圖片
<script>
var marqueeContent=new Array(); //待碼後期修改由 彩蝶提供!http://y1118s1115.spaces.live.com/
marqueeContent[0]='<font color="#0000CC">07/01/2008 </font><a href=http://y1118s1115.spaces.live.com/blog/cns!90FDECCBA8C96E98!1153.entry target=_blank class="f12red">酷極時鐘鼠標特效2007/5/13 上午 05:06:03</a><img src="http://wansanglee.googlepages.com/new4.gif"><br>';
marqueeContent[1]='<font color="#0000CC">07/01/2008 </font><a href=http://y1118s1115.spaces.live.com/blog/cns!90FDECCBA8C96E98!1152.entry target=_blank class="f12red">不停變色的背景2007/5/13 上午 05:03:54 </a><img src="http://wansanglee.googlepages.com/new4.gif"><br>';
marqueeContent[2]='<font color="#0000CC">07/01/2008 </font><a href=http://y1118s1115.spaces.live.com/blog/cns!90FDECCBA8C96E98!1150.entry target=_blank class="f12red">當圖片無法顯示時顯示另一張圖片</a><img src="http://wansanglee.googlepages.com/new4.gif"><br>';
marqueeContent[3]='<font color="#0000CC">07/01/2008 </font><a href=http://y1118s1115.spaces.live.com/blog/cns!90FDECCBA8C96E98!1151.entry target=_blank class="f12red">隨機背景音樂2007/5/13 上午 05:02:55 </a><img src="http://wansanglee.googlepages.com/new4.gif"><br>';
var marqueeInterval=new Array(); //
var marqueeId=0;
var marqueeDelay=4000;
var marqueeHeight=20;
//
function initMarquee() {
var str=marqueeContent[0];
document.write('<div id=marqueeBox style="overflow:hidden;height:'+marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>');
marqueeId++;
marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay);
}
function startMarquee() {
var str=marqueeContent[marqueeId];
marqueeId++;
if(marqueeId>=marqueeContent.length) marqueeId=0;
if(marqueeBox.childNodes.length==1) {
var nextLine=document.createElement('DIV');
nextLine.innerHTML=str;
marqueeBox.appendChild(nextLine);
}
else {
marqueeBox.childNodes[0].innerHTML=str;
marqueeBox.appendChild(marqueeBox.childNodes[0]);
marqueeBox.scrollTop=0;
}
clearInterval(marqueeInterval[1]);
marqueeInterval[1]=setInterval("scrollMarquee()",20);
}
function scrollMarquee() {
marqueeBox.scrollTop++;
if(marqueeBox.scrollTop%marqueeHeight==(marqueeHeight-1)){
clearInterval(marqueeInterval[1]);
}
}
initMarquee();
</script>
預覽效果 
|
|