Tip: you can modify some code before running
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>Allows you to control the effect of switching between playback and stopped Image slides.</title><meta http-equiv="content-type" content="text/html;charset=gb2312"><!--把下面代码加到<head>与</head>之间--><script type="text/javascript">Var the_images = new Array (); the_images [0] = new Image (); the_images [1] = new Image (); the_images [2] = new Image (); the_images [0]. src = "yun_qi_img/huandeng1.jpg"; the_images [1]. src = "/effect/images/huandeng2.jpg"; the_images [2]. src = "/effect/images/huandeng3.jpg"; var the_timeout; var index = 0; function rotateImage () {// specify ument. my_image.src = the_image S [index]. src; // The first pair is displayed because the index is 0, and then it passes through setTimeout ("rotateImage ();", 1000 ); in the second run, I still think the index should be equal to 0 index ++; if (index> = the_images.length) {// because index = 0 was set at the beginning, this if condition is not true. Since it is not true, the index value is still 0. For example, if the condition is true, the returned value is equal to 0. Why do we need this sentence? Index = 0;} the_timeout = setTimeout ("rotateImage ();", 1000 );}</script></head><body><!--把下面代码加到<body>与</body>之间--><br><input type="button" value="播放" onClick="clearTimeout(the_timeout);rotateImage();"><input type="button" value="停止" onClick="clearTimeout(the_timeout)"></body></html></td> </tr></table>
Tip: you can modify some code before running