var transitionstext = new array; transitionstext[0] = "progid:dximagetransform.microsoft.gradientwipe(duration=0.5)"; /** 从左往右渐变出 */ transitionstext[1] = "progid:dximagetransform.microsoft.fade(duration=1)"; /** 整体渐变出 */ transitionstext[2] = "progid:dximagetransform.microsoft.blinds(duration=0.7,bands=20)"; /** 横向百叶窗 */ transitionstext[3] = "progid:dximagetransform.microsoft.checkerboard(duration=0.7,squaresx=20,squaresy=20)"; /** 方块百叶窗 */ transitionstext[4] = "progid:dximagetransform.microsoft.randomdissolve(duration=0.7,orientation=vertical)"; /** 随机点 */ transitionstext[5] = "progid:dximagetransform.microsoft.randombars(duration=0.7,orientation=vertical)"; /** 随机竖线 */ var maximg; var nowimg = 1; var begin; var interval = 4000; /** 切换间隔 */ var hasnum=false; /** 是否有数字快捷切换的判断 */ function initmax(){ /** 修正总数并触发动作 */ for (var i=1;i<=20;i++){ if(!document.getelementbyid("pichdp"+i)){ maximg=i-1; break; }else{ addmouseactions(document.getelementbyid("pichdp"+i)); } } if(document.getelementbyid("num1")) hasnum=true; if(maximg > 0) playit(); /** 第一次开始计时 */ } function initialization(){ /** 自动切换 */ if(nowimg == maximg) next = 1; else next = nowimg + 1; document.getelementbyid("pichdp" + next).style.display=""; filtershowit(document.getelementbyid("pichdp" + next)); document.getelementbyid("pichdp" + nowimg).style.display="none"; if(hasnum) { for (var i=1;i<=maximg;i++){ document.getelementbyid("num"+i).classname="link"; if(i == next){ document.getelementbyid("num"+i).classname="current"; } } } if(nowimg == maximg) nowimg = 1; else nowimg++; playit(); /** 新的计时 */ } function showit(x){ /** 手动切换 */ if(nowimg==x)return; if(maximg > 1){ stopit(); for (var i=1;i<=maximg;i++){ document.getelementbyid("pichdp" + i).style.display="none"; if(hasnum) document.getelementbyid("num"+i).classname="link"; if(i == x){ document.getelementbyid("pichdp" + i).style.display="block"; if(hasnum) document.getelementbyid("num"+i).classname="current"; filtershowit(document.getelementbyid("pichdp" + i)); } } nowimg=x; } } function playit(){ /** 重新开始自动计时 */ if(maximg > 1){ cleartimeout(begin); begin = settimeout('initialization()', interval); } } function stopit(){ /** 停止计时 */ if(maximg > 1) cleartimeout(begin); } function filtershowit(crosstick){ /** 添加切换的滤镜效果 */ if(document.body.getattribute('cms:paflag') )return; if (!crosstick.filters)return; var innerhtml = crosstick.innerhtml; crosstick.innerhtml=""; crosstick.style.filter=transitionstext[math.floor(math.random() * (transitionstext.length))]; crosstick.filters[0].apply(); crosstick.innerhtml =innerhtml; crosstick.filters[0].play(); } function addmouseactions(obj){ /** 给对象增加鼠标事件:移入停止、移出开始 */ obj.onmouseover=function(){ stopit(); } obj.onmouseout=function(){ playit(); } } if(document.all) window.attachevent('onload',initmax); else window.addeventlistener('load',initmax,false);