The Train Gif JavaScript Tutorial

Scene Placement

There are three ways to create a place for a scene, in your document. The first two methods use variations of the locateScene function. The other one uses locateSceneBg to create a scene from a background image. The three scenes below show the three types of scene, along with the code to create them.

Even with a fixed width scene you can't make text flow around it, but you can use tables to integrate your scene more seamlessly into your document.

Full Width Scene
<SCRIPT> locateScene("normal", 40)</SCRIPT>
This is intended for simple scenes only, scenes used as "page-dividers". For more complex scenes, it is suggested you use either a fixed width or background based scene.

Fixed Width Scene
<SCRIPT> locateScene("width", 30, 300)</SCRIPT>

Background Based Scene
<SCRIPT> locateSceneBg("background", "background.gif")</SCRIPT>

Remember that there must be on scene placement call for each scene defined in traingifSetup, and they must all be inside the <BODY> section of your document.


If you re-load this page, you'll see that the trains, in each scene, start moving at different times. This is possible because of the extra parameter in the advanced version of createTrack. This capability is intended for multi-track scenes, so that the first train in each track doesn't enter the scene at the same time. This is a one-time-only delay, and doesn't effect any subsequent iterations through the train list for the track.