»
Tiếng AnhTiếng PhápTiếng Việt

In - Chữ cuộn kiểu ticker - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Scrollers » Theo chiều đứng » Chữ cuộn kiểu ticker
URL: https://www.javascriptbank.com/highlighter-scroller-ii.html

Chữ cuộn kiểu ticker © JavaScriptBank.comHiệu ứng tạo một đoạn tin tức nhỏ xuất hiện trên trang web với cách xuất hiện như đang được dán lên trang web. Bạn có thể thay đổi các thông số của đoạn mã JavaScript để tạo các tin tức trên trang web của mình.

Phiên bản đầy đủ: jsB@nk » Scrollers » Theo chiều đứng » Chữ cuộn kiểu ticker
URL: https://www.javascriptbank.com/highlighter-scroller-ii.html



HTML
<script type="text/javascript">//CONFIGURE MESSAGES AND VARIABLESvar tickercontents=new Array()tickercontents[0]='Looking for free JavaScript? Visit <a href="http://JavaScriptBank.com">JavaScriptBank.com</a>!'var tickerwidth="200px"var tickerheight="70px"var fontcss="font: bold 14px Verdana; color:black"var tickdelay=3000 //delay btw messagesvar highlightspeed=2 //2 pixels at a time.var highlightcolor="lightyellow"var backdroptextcolor="#E1E1E1"////Do not edit pass this line////////////////document.write('<style>#highlighterbg a{color:'+backdroptextcolor+'}</style>')document.write('<div style="position:relative;left:0px;top:0px; width:'+tickerwidth+'; height:'+tickerheight+';'+fontcss+'">')document.write('<span id="highlighterbg" style="position:absolute;left:0;top:0;color:'+backdroptextcolor+'; width:'+tickerwidth+'; height:'+tickerheight+';padding: 4px"></span><span id="highlighter" style="position:absolute;left:0;top:0;clip:rect(auto auto auto 0px); background-color:'+highlightcolor+'; width:'+tickerwidth+';height:'+tickerheight+';padding: 4px"></span>')document.write('</div>')var currentmessage=0var clipbottom=1function changetickercontent(){msgheight=clipbottom=crosstick.offsetHeightcrosstick.style.clip="rect("+msgheight+"px auto auto 0px)"crosstickbg.innerHTML=tickercontents[currentmessage]crosstick.innerHTML=tickercontents[currentmessage]highlightmsg()}function highlightmsg(){//var msgheight=crosstick.offsetHeightif (clipbottom>0){clipbottom-=highlightspeedcrosstick.style.clip="rect("+clipbottom+"px auto auto 0px)"beginclip=setTimeout("highlightmsg()",20)}else{clipbottom=msgheightclearTimeout(beginclip)if (currentmessage==tickercontents.length-1) currentmessage=0else currentmessage++setTimeout("changetickercontent()",tickdelay)}}function start_ticking(){crosstickbg=document.getElementById? document.getElementById("highlighterbg") : document.all.highlighterbgcrosstick=document.getElementById? document.getElementById("highlighter") : document.all.highlightercrosstickParent=crosstick.parentNode? crosstick.parentNode : crosstick.parentElementif (parseInt(crosstick.offsetHeight)>0)crosstickParent.style.height=crosstick.offsetHeight+'px'elsesetTimeout("crosstickParent.style.height=crosstick.offsetHeight+'px'",100) //delay for Mozilla's sakechangetickercontent()}if (document.all || document.getElementById)window.onload=start_ticking</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->