Vlnící se text (2) - ukázka zdrojového kódu zdrojový kód

<html>
<head>
<title>Java Script ze stránky - www.jaknaweb.com</title>
<script language="JavaScript">
<!--
var text = "JakNaWeb.com - vše por Váš web";
var msg = "<span style='font-size: 25px; visibility: hidden;'>.</span>";

function animace(index)
{
    for (i = 0; i < text.length; i++)
    {
        if (index == (i - 3))
        {
            msg += "<span style='font-size: 16px; color: #000033;'>" + text.charAt(i) + "</span>";
        } else if (index == (i - 2))
        {
            msg += "<span style='font-size: 20px; color: #000066;'>" + text.charAt(i) + "</span>";
        } else if (index == (i - 1))
        {
            msg += "<span style='font-size: 23px; color: #000099;'>" + text.charAt(i) + "</span>";
        }else if (index == i)
        {
            msg += "<span style='font-size: 25px; color: #0000cc;'>" + text.charAt(i) + "</span>";
        } else if (index == (i + 1))
        {
            msg += "<span style='font-size: 23px; color: #000099;'>" + text.charAt(i) + "</span>";
        } else if (index == (i + 2))
        {
            msg += "<span style='font-size: 20px; color: #000066;'>" + text.charAt(i) + "</span>";
        } else if (index == (i + 3))
        {
            msg += "<span style='font-size: 16px; color: #000033;'>" + text.charAt(i) + "</span>";
        } else
        {
            msg += "<span style='font-size: 12px;'>" + text.charAt(i) + "</span>";
        }
    }
    anim.innerHTML = msg;
    msg = "<span style='font-size: 25px; visibility: hidden;'>.</span>";
    if (index >= text.length)
    {
        index = 0;
    } else
    {
        index++;
    }
    window.setTimeout("animace(" + index + ")", 100);
}
// -->
</script>
</head>
<body OnLoad="animace(0);">
<br><br>
<center>
<div id="anim" style="font-family: Verdana; font-weight: bold;"></div>
</center>
</body>
</html>
Vložil/Poslal/Autor: Admin
Funkčnost: správná funkčnost testována v IE 6 a Firefoxu
zavřít okno | jít na hlavní stránku JakNaWeb.com