An animated background from a script.
View the source, which is commented.

A function is called from BODY with onLoad. The first function sets the timer interval and calls a second function, which uses a counter to set the background image.

Note the syntax needed to assign the image to the background:

  document.body.style.background="url(" + nameofimage + ")";

For this to work, the images used in the animation could not be transparent. Apparently the browser interprets the transparency as white. With white snowflakes and white text, it didn't look like anything was happening!! But the cursor flickered. So I figured out that the animation was running, but just wasn't being seen.

This effect is of limited use, but demonstrates several interesting points about syntax and timing.

Back to Jan's Web Scripting Demo


© 1997-2014 Jan Smith   <jegs1@jegsworks.com>