首页 > 代码库 > 3d旋转展示代码
3d旋转展示代码
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>3D展示</title>
<style type="test/css">
#box{
height:378px;
width:640px;
}
</style>
</head>
<body onl oad="init();">
<div id="box">
<img id="img" src="E:/img/miaov (0).jpg">
</div>
<input type="button" value="http://www.mamicode.com/show" onclick="show();" />
<input type="button" value="http://www.mamicode.com/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>
3d旋转展示代码