日期:2014-05-16 浏览次数:20417 次
<!doctype html>
<html>
<head>
<title></title>
<meta charset="utf-8" />
</head>
<body onload="start()">
<img src="" name="im"/>
<script>
var imgsrc;
var i = 0, gw = 0, sw = 0, bw = 0;
function start() {
window.setInterval(a, 100);
}
function a() {
imgsrc = "IMG00" + bw + "" + sw + "" + gw + ".bmp";
gw++;
if (gw >= 9) {
gw = 0;
sw++;
if (sw >= 9) {
sw = 0;
bw++;
}
}
if(bw+""+ sw+""+gw =="150"){
gw = 0, sw = 0, bw = 0;
}
document.images.im.src = imgsrc;
}
</script>
</body>
</html>
<html>
<head>
<script>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var imgIndex = 0;
var timer = 150;
var imgObj;
var img1 = "./01.png";
var img2 = "./02.png";
var img3 = "./03.png";
var img4 = "./01.png";
var imgArr = [img1, img2, img3, img4];
window.onload = function(){
imgObj = document.getElementById("img");
setInterval(onframe, timer);
}
function onframe() {
if(imgIndex >= imgArr.length-1){
imgIndex = 0;
}else{
imgIndex ++;
}
imgObj.src = imgArr[imgIndex];
}
</script>
</head>
<body>
<img id="img" style="margin:50px 0 0 50px;" />
</div>
</body>
</html>