Scroll text in the status bar using JavaScript

Introduction

 
In this blog, we will know how to scroll the text in the status bar using JavaScript.
 
Store the files as .html or .htm extension. Run it in IE.
 
Example-1
  1. <html>    
  2.     <head>    
  3.         <title>Javascript ScrollText</title>    
  4.         <script language="javascript">    
  5.             msg="This is an example of scrolling message";                
  6.             spacer="............ .............";                
  7.             pos=0;                
  8.             function ScrollMessage()                
  9.             {                
  10.                 window.status=msg.substring(pos,msg.length)+spacer+msg.substring(0,pos);                
  11.                 pos++;                
  12.                 if(pos>msg.length)  
  13.                     pos=0;    
  14.                 window.setTimeout("ScrollMessage()",100);    
  15.             }    
  16.             ScrollMessage();    
  17.         </script>    
  18.     </head>    
  19.     <body>    
  20.         <p>Scrolling Message Example</p>    
  21.         <p>Look at the status line at the bottom of the page</p>    
  22.     </body>    
  23. </html>   
Example-2
  1. <HTML>  
  2.     <HEAD>  
  3.         <title>Moving Text</title>  
  4.         <script language="javascript">  
  5.             var current=0;  
  6.             var x = 0;  
  7.             var speed = 150;  
  8.             var speed2 = 150;  
  9.             function startarray(n)  
  10.             {  
  11.                 this.length = n;  
  12.                 for(var i =1; i <=n; i++)  
  13.                 {  
  14.                     this[i]="";  
  15.                 }  
  16.             }  
  17.             dis_letters= new startarray(1);  
  18.             dis_letters[0]="Website Created By Satyapriya Nayak";  
  19.             function display_letters()  
  20.             {  
  21.                 var m = dis_letters[current];  
  22.                 window.status = m.substring(0,x++) + "";  
  23.                 if (x == m.length + 1)  
  24.                 {  
  25.                     x=0;  
  26.                     current++;  
  27.                     if (current > dis_letters.length-1)  
  28.                     {  
  29.                         current=0;  
  30.                     }  
  31.                     setTimeout("display_letters()",speed2);  
  32.                 }  
  33.                 else  
  34.                 {  
  35.                     setTimeout("display_letters()",speed);  
  36.                 }  
  37.             }  
  38.             display_letters();  
  39.         </script>  
  40.     </Head>  
  41.     <body>  
  42.         <p>Scrolling Message Example</p>  
  43.         <p>Look at the status line at the bottom of the page</p>  
  44.     </body>  
  45. </Html> 
Thanks for Reading