下面是代码
------------------------------------------------------------------------------------------
function createWavePlane($ID,$MAX,$WIDTH,$HEIGHT,$DELAY,$PICTUREARRAY){
//存放ID,个数,宽度,高度,图片数组
var $JUDGE=1;var $INDEX=1;var $TIME;
for(i=0;i<$MAX;i++){
var $MODLE=document.createElement("div");
$MODLE.id="$IDCHUNK"+i;
$MODLE.style.position="absolute";
$MODLE.style.top="0px";
$MODLE.style.left=$WIDTH*i;
$MODLE.style.width=$WIDTH;
$MODLE.style.height=$HEIGHT;
$MODLE.style.backgroundRepeat="no-repeat";
$MODLE.style.backgroundImage=$PICTUREARRAY[0];
$MODLE.style.backgroundSize=$WIDTH*$MAX+"px "+$HEIGHT+"px";
$MODLE.style.backgroundPosition=-($WIDTH*i)+"px 0px";
document.getElementById($ID).appendChild($MODLE);
}
//创建界面
function $BODY(){
alert("body");
document.getElementById("$IDCHUNK"+$JUDGE).style.backgroundImage=$PICTUREARRAY[$INDEX];
if($JUDGE==$MAX){
if($INDEX==$PICTUREARRAY.length){
$INDEX=0;
}
else{
$INDEX++;
}
$JUDGE=1;
clearInterval($TIME);
setTimeout("$START()",$DELAY);
}
else{
$JUDGE++;
}
}
//
function $START(){
$TIME=setInterval("$BODY",2000/$MAX);
}
//
$START();
}
------------------------------------------------------------------------------------------
慕婉清6462132
相关分类