87,902
社区成员
发帖
与我相关
我的任务
分享
<html>
<head>
<title></title>
<style>
.bg1 {
width:300px;
height:300px;
background-image:url('a.jpg');
background-position-x:-100px;
background-position-y:0px;
}
.bg2 {
width:300px;
height:300px;
background-image:url('a.jpg');
background-position-x:-140px;
background-position-y:0px;
}
</style>
<script>
var index = 0;
function f_onload(){
var vv = setInterval("next()",100);
}
function next(){
index ++;
if(index % 2 == 0){
document.getElementById("bg").className = "bg1";
}else{
document.getElementById("bg").className = "bg2";
}
}
</script>
</head>
<body onload="f_onload();">
<div id="bg" class="bg1">
</div>
</body>
</html>