复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://plete, set a flag to start when it is
if (!this.loaded) this.startOnLoad = true;
else {
// If we haven't looked up the image by id yet, do so now
if (!this.image) this.image = document.getElementById(this.imageId);
// Display the first frame immediately
this._displayNextFrame();
// And set a timer to display subsequent frames
this.timer = setInterval(this._displayNextFrame, this.frameInterval);
}
};
/** Stop an ImageLoop animation */
ImageLoop.prototype.stop = function () {
if (this.timer) clearInterval(this.timer);
this.timer = null;
};
</script>
<script type="text/javascript">
function de() {
var animation = new ImageLoop("loop", 1, ["img/img_01.jpg", "img/img_02.jpg",]);
var sta = document.getElementById("sta");
var stp = document.getElementById("stp");
sta.onclick = function () {
animation.start();
}
stp.onclick = function () {
animation.stop();
}
}
window.onload = function () {
de();
}
</script>
</head>
<body>
<img src="img/img_01.jpg" id="loop" alt="" title="" />
<a href="#" class="de" id="sta">Start</a>
<a href="#" class="de" id="stp">Stop</a>
</body>
</html>
