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

In - Chữ kiểu karaoke - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Chữ » Chữ kiểu karaoke » Chữ kiểu karaoke
URL: https://www.javascriptbank.com/introticker-with-fade-effect-and-preload-feature.html

Chữ kiểu karaoke © JavaScriptBank.comHiệu ứng sẽ giúp bạn tạo ra trên trang web các dòng chữ có màu thay đổi như đang hát karaoke.

Phiên bản đầy đủ: jsB@nk » Chữ » Chữ kiểu karaoke » Chữ kiểu karaoke
URL: https://www.javascriptbank.com/introticker-with-fade-effect-and-preload-feature.html



JavaScript
<SCRIPT>// Introticker with fade-effect and preload-feature// enter as many messages as you likevar message=new Array()message[0]="Hi stranger, how are you, my friend?"message[1]="Soon you will be directed to a very exciting tool."message[2]="This tool allows you to create 10 different slideshows without programming skills."message[2]="It's called Slideshow Factory and it's really unique."message[3]="Are you ready?"message[4]="Ok then let's jump to Slideshow Factory and have some fun!"// enter the width and height of the ticker (pixel)var tickerwidth=240var tickerheight=360// enter fontvar tickerfont="Arial"// enter font-sizevar tickerfontsize=5// enter the three font-colorsvar tickerfontcolorpre="#FFFF00"var tickerfontcolormark="#FFFFFF"var tickerfontcolorafter="#333333"// enter the background-colorvar backgroundcolor="black"// enter the pause between each word marked (1000 = 1 second)var pausebetweenwords=200 // enter the pause between each message (1000 = 1 second)var pausebetweenmessages=2000// enter the pause after the fade effect (1000 = 1 second)var pauseafterfade=1000// enter the URl of the next webpagevar linkurl="http://JavaScriptBank.com"// do not edit the code below this linevar transparency=100var transparencystep=5var windowheight=0var windowwidth=0var x_pos=0var y_pos=0var i_message=-1var messagesplit=""var i_messagesplit=0var i_mark=0var tickercontentvar pausefade=40var linkurlloaded=falsevar oneloopfinished=falsevar ns4=document.layers?1:0var ns6=document.getElementById&&!document.all?1:0 var ie=document.all?1:0function splitmessage() {transparency=100if (ie) {i_message++if (i_message>=message.length) {oneloopfinished=true}if (i_message>=message.length) {i_message=0}i_mark=0messagesplit=message[i_message].split(" ")for (i=0;i<messagesplit.length;i++) {messagesplit[i]=messagesplit[i]+" "}messagesplit[messagesplit.length]=" "document.all.ticker.filters.alpha.opacity=transparencyif (oneloopfinished && linkurlloaded) {document.location.href=linkurl}else {runticker()}}else if (ns6 || ns4) {i_message++if (i_message>=message.length) {document.location.href=linkurl}else {i_mark=0messagesplit=message[i_message].split(" ")for (i=0;i<messagesplit.length;i++) {messagesplit[i]=messagesplit[i]+" "}messagesplit[messagesplit.length]=" "if (ns6) {document.getElementById('ticker').style.MozOpacity=transparency/100}runticker()}}else {document.location.href=linkurl}}function runticker() {if (i_mark<messagesplit.length) {gettickercontent()if (ie) {ticker.innerHTML=tickercontent}if (ns6) {document.getElementById('ticker').innerHTML=tickercontent}if (ns4) {document.ticker.document.write(tickercontent)document.ticker.document.close()}  i_mark++  var tickertimer=setTimeout("runticker()",pausebetweenwords)}else {clearTimeout(tickertimer)setTimeout("fade()",pausebetweenmessages)}}function fade() {if (transparency>0){transparency-=transparencystepif (ie) {document.all.ticker.filters.alpha.opacity=transparency}if (ns6) {document.getElementById('ticker').style.MozOpacity=transparency/100}var fadetimer=setTimeout("fade()",pausefade)}else {clearTimeout(fadetimer)setTimeout("splitmessage()",pauseafterfade)}}function gettickercontent() {tickercontent="<table width="+tickerwidth+" height="+tickerheight+" cellpadding=0 cellspacing=0 border=0><tr valign=middle><td align=center>"tickercontent+="<font face=\""+tickerfont+"\" size="+tickerfontsize+" color=\""+tickerfontcolorpre+"\">"for (i=0;i<i_mark;i++) {tickercontent+=messagesplit[i]}tickercontent+="</font>"tickercontent+="<font face=\""+tickerfont+"\" size="+tickerfontsize+" color=\""+tickerfontcolormark+"\">"tickercontent+=messagesplit[i_mark]tickercontent+="</font>"tickercontent+="<font face=\""+tickerfont+"\" size="+tickerfontsize+" color=\""+tickerfontcolorafter+"\">"for (i=(i_mark+1);i<messagesplit.length;i++) {tickercontent+=messagesplit[i]}tickercontent+="</font>"tickercontent+="</td></tr></table>"}setposition()function setposition() {if (ie) {windowheight=document.body.clientHeightwindowwidth=document.body.clientWidth}if (ns6) {windowheight=window.innerHeightwindowwidth=window.innerWidth}if (ns4) {windowheight=window.innerHeightwindowwidth=window.innerWidth}x_pos=(windowwidth-tickerwidth)/2y_pos=(windowheight-tickerheight)/2document.bgColor=backgroundcolor}function jump() {linkurlloaded=true}if (ie) {document.write("<div id=\"ticker\" style=\"position:absolute;top:"+y_pos+"px;left:"+x_pos+"px;width:"+tickerwidth+"px;height:"+tickerheight+"px;overflow:hidden\;filter:alpha(opacity=100);-moz-opacity:100\">")document.write("</div>")document.write("<iframe onLoad=\"jump()\" src="+linkurl+" width=0 height=0></iframe>")splitmessage()}else if (ns6) {document.write("<div id=\"ticker\" style=\"position:absolute;top:"+y_pos+"px;left:"+x_pos+"px;width:"+tickerwidth+"px;height:"+tickerheight+"px;overflow:hidden\;-moz-opacity:100\">")document.write("</div>")splitmessage()}else if (ns4) {document.write("<layer name=\"ticker\" width="+tickerwidth+" height="+tickerheight+" top="+y_pos+" left="+x_pos+">")document.write("tickercontent")document.write("</layer>")document.close()window.onload=splitmessage}else {document.location.href=linkurl}</SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->