Monday, October 24, 2011

Javascript example 1: Flushing Text

This is the script for creating flushing text in your webpage:
<script>
    var changeStatus = 0;
    function flushingText()
    {
        if(changeStatus == 0)
        {
            status = "Hello JavaScript...";  //Your text
            changeStatus = 1;
        }
        else
        {
            status = "";
            changeStatus = 0;
        }
        setTimeout("flushingText()",200);  //Timer
    }

</script>

 The whole script will look like this:

 <html>
<head>
<!--
    Flushing text in the statusbar
-->
<script>
    var changeStatus = 0;
    function flushingText()
    {
        if(changeStatus == 0)
        {
            status = "Hello JavaScript...";
            changeStatus = 1;
        }
        else
        {
            status = "";
            changeStatus = 0;
        }
        setTimeout("flushingText()",200);
    }

</script>
</head>

<body onload="flushingText()"><!--Call flushingText method while loading the webpage-->

</body>
</html>


No comments:

Post a Comment