Scroll text in the status bar using JavaScript

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

 

<html>

<head>

<title>Javascript ScrollText</title>

<script language="javascript">

msg="This is an example of scrolling message";

spacer="............ .............";

pos=0;

function ScrollMessage()

{

window.status=msg.substring(pos,msg.length)+spacer+

msg.substring(0,pos);

pos++;

if(pos>msg.length)pos=0;

window.setTimeout("ScrollMessage()",100);

}

ScrollMessage();

</script>

</head>

<body>

<p>Scrolling Message Example</p>

<p>Look at the status line at the bottom of the page</p>

</body>

</html>

 

Example-2

 

<HTML>

<HEAD>

<title>Moving Text</title>

<script language="javascript">

 

var current=0;

var x = 0;

var speed = 150;

var speed2 = 150;

function startarray(n)

{

this.length = n;

for(var i =1; i <=n; i++)

{

this[i]="";

}

}

dis_letters= new startarray(1);

dis_letters[0]="Website Created By Satyapriya Nayak";

 

function display_letters()

{

var m = dis_letters[current];

window.status = m.substring(0,x++) + "";

if (x == m.length + 1)

{

x=0;

current++;

if (current > dis_letters.length-1)

{

current=0;

}

 

setTimeout("display_letters()",speed2);

 

}

else

{

setTimeout("display_letters()",speed);

}

}

display_letters();

</script>

</Head>

<body>

<p>Scrolling Message Example</p>

<p>Look at the status line at the bottom of the page</p>

</body>

</Html>



Thanks for Reading

Ebook Download
View all
Learn
View all