dcsimg

Assignment 43: A Possible Answer

This:

<script lanuage="JavaScript">

var RightNow = new Date()

var ampm = RightNow.getHours() +1
if (ampm > 18)
{nampm = "Good Evening"}
else
if (ampm > 12)
{nampm = "Good Afternoon"}
else
if (ampm < 12 )
{nampm = "Good Morning"}

var scr = " "
var scr = scr + nampm + " Welcome to my page"

function ScrollAlong()
{
temp = scr.substring(0,1);
scr += temp
scr = scr.substring(1,scr.length);
defaultStatus = scr.substring(0,55);
counter = setTimeout("ScrollAlong()",50);
}

</script>

 

Gives you the scroll:

     You get the effect by setting up the same "nampm" variable as was found in Assignment 39. The return of the variable is then inserted into the text that will scroll.

     Finally, the output of the scroll is sent to the status bar. Great effect.

 

Did You Get It?

 

Back to the Index Page