码迷,mamicode.com
首页 > Web开发 > 详细

JS图像变换效果的实现

时间:2015-07-15 12:48:03      阅读:104      评论:0      收藏:0      [点我收藏+]

标签:

<html>

<head>

<style type="text/css">

#apDiv1 {
position: absolute;
left: 178px;
top: 65px;
width: 271px;
height: 195px;
background-image:url(../images/author1.jpg);
z-index: 1;
}
</style>

</head>

 

<body>

<div id="apDiv1"></div>

<script>
var arr = new Array();
arr[0]="url(../images/author1.jpg)";
arr[1]="url(../images/author2.jpg)";
arr[2]="url(../images/author3.jpg)";
arr[3]="url(../images/author4.jpg)";

var i=0;
function changeimage()
{
if(i==4)
{
i=0;

}
var div=document.getElementById("apDiv1");
div.style.backgroundImage=arr[i];
i++;
window.setTimeout("changeimage()",1000) ;
}
changeimage();
</script>

</body>

</html>

JS图像变换效果的实现

标签:

原文地址:http://www.cnblogs.com/xuxuefeng8906/p/4647892.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!