复制代码 代码如下:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>images</title>
<script type="text/javascript">
var curIndex = 0;
var timeInterval = 1000;
var arr = new Array();
arr[0] = "1 (1).jpg";
arr[1] = "1 (2).jpg";
arr[2] = "1 (3).jpg";
arr[3] = "1 (4).jpg";
arr[4] = "1 (5).jpg";
arr[5] = "1 (6).jpg";
arr[6] = "1 (7).jpg";
arr[7] = "1 (8).jpg";
setInterval(changeImg,timeInterval);
function changeImg() {
var obj = document.getElementById("obj");
if (curIndex == arr.length-1) {
curIndex = 0;
} else {
curIndex += 1;
}
obj.src = arr[curIndex];
}
</script>
<script language="javascript">
setInterval(test,1000);
var array = new Array();
var index = 0;
var array = new Array("1 (1).jpg","1 (2).jpg","1 (3).jpg","1 (4).jpg","1 (5).jpg","1 (6).jpg","1 (7).jpg","1 (8).jpg");
function test() {
var myimg=document.getElementById("imgs");
if(index==array.length-1)
{ index=0; }else{ index++; }
myimg.src=array[index];
}
</script>
</head>
<body>
<img id = "obj" src="/UploadFiles/2021-04-02/1 (1).jpg"> </body>
<body>
</body>
</html>
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!