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


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

Tagged as: , , , , , ,

Leave a Reply

You must be logged in to post a comment.