Posted in Javascript onDecember 12, 2007
浏览网站时发现这个代码,非常的不错,高度为20的,文本广告
调用代码:<script type="text/javascript" src="http://img.3water.com/imgby/txtad.js"></script>
var marqueeContent=new Array(); //滚动主题 marqueeContent[0]='<a href="http://www.pcjc8.com" target="_blank">全站资料下载站</a>'; marqueeContent[1]='<a href="https://3water.com/adsense/adsense.htm" target="_blank">Google AdSense</a>'; marqueeContent[2]='<a href="https://3water.com/firefox/firefox.html" target="_blank">火狐浏览器下载</a>'; marqueeContent[3]='<a href="https://3water.com/support.htm" class="hot" target="_blank">全站广告位招租</a>'; marqueeContent[4]='<a href="http://www.pcjc8.com" class="hot" target="_blank">全站资料下载站</a>'; marqueeContent[5]='<a href="https://3water.com/adsense/adsense.htm" target="_blank">Google AdSense</a>'; marqueeContent[6]='<a href="http://www.pcjc8.com" class="hot">全站资料下载站</a>'; 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()",10); } function scrollMarquee() { marqueeBox.scrollTop++; if(marqueeBox.scrollTop%marqueeHeight==marqueeHeight){ clearInterval(marqueeInterval[1]); } } initMarquee();
文本链接逐个出现的js脚本
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@