Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Example
Insert the following script in the
section of your HTML Web page:
<script Language="JavaScript">
// Scrolling text string.
var strText="This is a scrolling message!";
// Length of the text
var intText=strText.length;
// Speed of the scroll
var intSpeed=25;
// Width of the scrolling area.
var intWidth=100;
var intPos=1-intWidth;
function scroll()
{
// Initialize the string to be printed.
intPos++;
var strScroll="";
// Move to the right in the string.
if (intPos==intText)
{
// Start over if the string is done.
intPos=1-intWidth;
}
// Scrolling
if (intPos<0)
{
// Add spaces to beginning if necessary.
for (var i=1; i<=Math.abs(intPos); i++)
{
strScroll=strScroll+" ";
}
strScroll=strScroll+strText.substring(0, intWidth-i+1);
}
else
{
strScroll=strScroll+strText.substring(intPos,intWidth+intPos);
}
window.status = strScroll;
setTimeout("scroll()", intSpeed);
}
</script>
In order for the message to function, modify the <BODY> tag so that it looks like this: