<!-- 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 11:59, local time: 2024/8/22 22:18,
3.14.254.54: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? <A HREF="http://piclist.com/tecHREF/language/java/script/definitive/examples/16.1.txt"> language java script definitive examples 16</A> |
Did you find what you needed? |
![]() o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.