JavaScript Tutorial/Animation/Status Bar

Материал из Web эксперт
Перейти к: навигация, поиск

Windows statusbar scrolling message

<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
var counter = 0
var msg = "Thanks";
function scrollMsg()
{
    if (counter < 10)
    {
        window.status = msg;
        msg = msg.substring(1,msg.length) + msg.substring(0,1);
        setTimeout("scrollMsg()",150);
        counter += 1
    } else {
        window.status = "";
    }
}
//  -->
</script>
</head>
<body onload="scrollMsg()">
</body>
</html>


Window status bar animation (IE)

<html>
<head>
<title>A Simple Page</title>
<script language="JavaScript">
<!--
var msg = "Thanks for visiting our Web site! ... ";
function scrollMsg()
{
    window.status = msg;
    msg = msg.substring(1,msg.length) + msg.substring(0,1);
    setTimeout("scrollMsg()",150);
}
//  -->
</script>
</head>
<body onload="scrollMsg()">
</body>
</html>