<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>3D展示</title>
<style type="test/css">
#box{
height:378px;
width:640px;
}
</style>
</head>

<body onload="init();">
<div id="box">
<img id="img" src="E:/img/miaov (0).jpg">
</div>
<input type="button" value="show" onclick="show();" />
<input type="button" value="stop" onclick="stop();" />
<script type="text/javascript">
var box;
var pic_arr=[];
var index=0;


function init(){
box=document.getElementById("box");
for(var i=0;i<=76;i++){
pic_arr[i]=document.createElement("img");
pic_arr[i].src="E:/img/miaov ("+i+").jpg";
}

}
function picRoll(){
if(index==0){
try{
box.removeChild(pic_arr[76]);
}catch(e){

}
box.appendChild(pic_arr[0]);
index++;
}else if(index>0&&index<=76){
box.removeChild(pic_arr[index-1]);
box.appendChild(pic_arr[index]);
index++;
}else if(index>76){
index=0;
}
}

function show() {
var aa=document.getElementById("img");
box.removeChild(aa);
taskid=setInterval(picRoll,50);
}

function stop(){
clearInterval(taskid);
}

</script>
</body>
</html>

posted on 2014-10-25 19:06  飞逝的流言  阅读(157)  评论(1编辑  收藏  举报