Controls the switching effect of playback or stopped Image slides in javascript photo albums

Source: Internet
Author: User
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
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.