SCROLLING MESSAGE IN STATUSBAR USING JAVASCRIPT

 

 PROGRAM:

<html>
<head>
<script language="Javascript">


var CurrentMsg = "Welcome To KRMMC";
var CurrentPosition = 0;

function MessageScroll() {

//The status property sets the text in the status bar at the bottom of the browser.
//The substring() method extracts the characters from a string, between two specified indices,
//and returns the new sub string.

status = CurrentMsg.substring(CurrentPosition, CurrentMsg.length) + CurrentMsg.substring(0,CurrentPosition);
   CurrentPosition++;
   if (CurrentPosition > CurrentMsg.length) CurrentPosition = 0;

// set timeout for next update
//The setTimeout() method calls a function or evaluates an expression after a specified number of milliseconds.

//Tip: 1000 ms = 1 second.

   window.setTimeout("MessageScroll()",1000);
}

// Start the scrolling message

MessageScroll();

</script>
</head>
<body>
<h1>
Check the status bar ... <br/>You Would be seeing a scrolling message</h1>
</body>
</html>

OUTPUT:



Check the status bar ...
You Would be seeing a scrolling message

No comments:

Post a Comment