In this applet, you need to set the name of the picture under the Images folder in order, 1, 2, 3 ...
Copy Code code as follows:
<script type= "Text/javascript" >
var imgnumb = 1;
function Imgfor () {
imgnumb++;
document.getElementById (' Img1 '). setattribute (' src ', ' images/' + imgnumb + '. jpg ');
if (Imgnumb = = 5) {//Total 5 photos
Imgnumb = 0;
}
}
var Clearid;
function Clearfun () {
Clearinterval (Clearid);
}
Clearid=setinterval (imgfor, 500);
</script>
<body>
<input type= "button" value= "End Execution" onclick= "Clearfun ();"/>
</body>
var imgnumb = 1;
function Imgfor () {
imgnumb++;
document.getElementById (' Img1 '). setattribute (' src ', ' images/' + imgnumb + '. jpg ');
if (Imgnumb = = 5) {
Imgnumb = 0;
}
}
var Clearid;
function Clearfun () {
Clearinterval (Clearid);
}
Clearid=setinterval (imgfor, 500);
</script>
<body>
<input type= "button" value= "End Execution" onclick= "Clearfun ();"/>
</body>