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>

Click here to support our work. Thanks :)

Incoming search terms:

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

Related posts:

  1. JavaScript – Google Maps With Pointer
  2. JavaScript – Password Generator
  3. PHP Script – Google Page Rank (PR) Checker
  4. Action Script – Walled Bouncing Ball
  5. PHP Script – Create PDF With FPDF

Posted on 2010-04-22 by Susanto BSc in Free Script, JavaScript
Tagged as: , , , , , ,

Leave a Reply

You must be logged in to post a comment.

Latest Tweets