JavaScript – Message/Text Scroller

This is a JavaScript to scroll a list of messages or texts to save spaces on your web page. It will show a text one after another from a list which can be displayed in a single DIV or INPUT element. It is best to implement this one for news texts and texts ads.

Demo

SCROLLED MESSAGES

Click the button to play the scroller

Source Code

<html>
    <head>
        <script language="JavaScript">
            //List your messages here
            var msg = new Array();
            msg[0] = "This is message 1";
            msg[1] = "This is message 2";
            msg[2] = "This is message 3";
            //Here's the function to scroll your messages
            function play(num){
                //Check whether it reach your last message
                //to go back to the first message
                if(num >= msg.length)
                    num = 0;
                //Variable declarations
                var tmp_elm = document.getElementById("div_display");
                var tmp = tmp_elm.innerHTML;
                var tmp_next;
                //Scrolling process
                var random = Math.floor(Math.random() * msg[num].length);
                var tmp_chr = msg[num].charAt(random);
                if(tmp == msg[num]){
                    num++;
                    setTimeout("play("+num+")",4000);
                    return;
                }
                if(tmp_chr == tmp.charAt(random)){
                    play(num);
                    return;
                }
                //Preparing output
                var first_part = tmp.substring(0,random);
                random++;
                var last_part = tmp.substring(random,msg[num].length);
                var tmp_next = first_part + tmp_chr + last_part;
                tmp_elm.innerHTML = tmp_next;
                //Recall play
                setTimeout("play("+num+")",200);
            }
        </script>
    </head>
    <body onload="play(0);">
        <div id="div_display">SCROLLED MESSAGES</div>
    </body>
</html>

Incoming Search Terms

testimonial scroller script, testimonials slider in javascript, scrolling testimonials javascript, javascript testimonial scroller, testimonials slider script, javascript scrolling testimonials, wp scroller, javascript message scroller, testimonial scroller javascript, wp text scroller, testimonials scroller javascript, javascript scrolling random messages that work in firefox -vir, text testimonial slider javascript, testimonial scroller java script, testimonial scroller for wp, text scroller js aleatorio, scroll text one after another, javascript message list, quote scroller javascript, text scroller, wordpress free plugin scrolling text, javascript scrolling message, javascript scroll random list, free javascript rss scrolling text, testimonials on website one by one in scroll, testimonial text scrolling script, testimonial scrolling script, testimonial scroller webpage codee, javascript list of message, testimonial scroller on website, javascript message, javascript message text slide, javascript messagelist, testimonial scroll text, sliding text one after the other in html, scrolling the text one after another with code, scrolling testimonials#, scrolling testimonials wordpress plugin, testimonials scroller 3 javascript for text, javascript array text print msg[1], Java Script Text-Scroller, how to avoid randomstart in textslide using javascript code, wordpress widget text scrollbar, html scroll random text, widget displaying text one after other, why testimonial scrolling JAVASCRIPT, textscroller javascript, texts scroller, text xcrolling in wp, html scrolling testimonial text, html scrolling text one after another, rss scroll text with javascript, text one after other in html, testimonials text scrolling, html sliding text one after another, javascript random scroller, scrolling random text with links javascript, random quote javascript scroller, random list java scrolling, random javascript scrolling different texts, php testimonials scroller, php scrolling testimonial, one after another text scrolling in html code, message scroller, latest css text scrolling demo, js testimonial scroller, javascript testimonials slider add author, javascript scrolling christman lights, javascript slider with random text, javascript slide testimonials, javascript scrolling list random order, random scrolling text script, random testimonial scroller, random testimonial text javascript, scrolling random text javascript, scrolling random link javascript, scrolling of text in javascript one after another, scrolling message javascript, scrolling arrays in javascript, scroller msg, Scroller javascript random, scroll text testimonial, javascript rolling testimonials, script for scroller message, javascript scroll list random start, rolling testimonal text, random text scroller javascript, random text scroller, display the testimonials one after another on my website, Xhanch, Xhanch Studio


Posted on 2010-04-22 by Susanto BSc in Free Script, JavaScript
Free, Code, Animate, Scroll, Scroller, Javascript, Script, Xhanch, Xhanch Studio

Tagged as: , , , , , ,

Leave a Reply

You must be logged in to post a comment.