please dont rip this site

Language Java Script Definitive Examples 16.1.TXT

 <!-- This example is from the book _JavaScript: The Definitive Guide_.     -->
<!-- Written by David Flanagan.  Copyright (c) 1996 O'Reilly & Associates. -->
<!-- This example is provided WITHOUT WARRANTY either expressed or implied.-->
<!-- You may study, use, modify, and distribute it for any purpose.        -->

<!-- The image that will be animated.  Give it a name for convenience -->
<IMG SRC="images/0.gif" NAME=animation>

<SCRIPT>
// Create a bunch of off-screen images, and get them started 
// loading the images we're going to animate.
images =index.html new Array(10);
for(var i = 0; i < 10; i++) {
    images[i] =index.html new Image();                 // Create an Image object
    images[i].src = "images/" + i + ".gif";  // tell it what URL to load
}

// Later, when we want to perform our animation, we can use these URLs,
// knowing that they've been loaded into the cache.  Note that we perform
// the animation by assigning the URL, not the Image object itself.
// Also note that we call the image by name, rather than as document.images[0]
function animate()
{
    document.animation.src = images[frame].src;
    frame = (frame + 1)%10;
    timeout_id = setTimeout("animate()", 250);  // display next frame later
}
var frame = 0;         // keep track of what frame of the animation we're on.
var timeout_id = null; // allows us to stop the animation.
</SCRIPT>

<FORM>                   <!-- Buttons to control the animation -->
  <INPUT TYPE=button VALUE="Start" 
         onClick="if (timeout_id ==index.html null) animate()">
  <INPUT TYPE=button VALUE="Stop" 
         onClick="if (timeout_id) clearTimeout(timeout_id); timeout_id=null;">
</FORM>


file: /Techref/language/JAVA/SCRIPT/definitive/examples/16.1.txt, 1KB, , updated: 1997/4/4 10:59, local time: 2024/12/24 05:27,
TOP NEW HELP FIND: 
3.145.43.92:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://sxlist.com/techref/language/JAVA/SCRIPT/definitive/examples/16.1.txt"> language JAVA SCRIPT definitive examples 16</A>

Did you find what you needed?

 

Welcome to sxlist.com!


Site supported by
sales, advertizing,
& kind contributors
just like you!

Please don't rip/copy
(here's why

Copies of the site on CD
are available at minimal cost.
 

Welcome to sxlist.com!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .