Saturday, 16 March 2019

Scrolling Messages java script

Here's an example of how to create a scrolling message:

<HTML>
    <HEAD>
        <TITLE>Scrolling Message</TITLE>
        <SCRIPT>
<!--
var winLength = 2ØØ; // guess at how many spaces wide the status bar is
var speed = 1ØØ; // number of milliseconds between updates
function scroll(count)
    {
    var msg = "Hi! This is my scrolling message in the status bar.";
    var out = " ";
    var cmd = "scroll(";

    if (count <= winLength && Ø < count)
        {
        var c = Ø;
        for (c = Ø ; c < count ; c++)
            {
            out += " ";
}
        out += msg;
        }
    else if (count <= Ø)
        {
        if (-count < msg.length)
            {
            out += msg.substring(-count,msg.length);
        }
        else
            {
            count = winLength + 1;
            }
        }
    window.status = out;
    count--;
    cmd += count + ")";
    window.setTimeout(cmd,speed);
    }
//-->


        </SCRIPT>
    </HEAD>
    <BODY ONLOAD="window.setTimeout('scroll(winLength)',speed);">
    </BODY>
</HTML>

No comments:

Post a Comment