如何通过按钮控制的图片上下翻滚效果(2)_动易Cms教程

编辑Tag赚U币
教程Tag:暂无Tag,欢迎添加,赚取U币!

//和
//<div class="NUM1" id="led3">3</div> …… (以此类推)
//另外还要在CSS中添加 .f3…… #led3……的相关定义

var direction = "down";
var mainobj = document.all("mainpic");

function scrolldown(f){
if (mainobj.scrollTop>=frameheight*(f-1)){
clearInterval(inter);
mainobj.scrollTop=frameheight*(f-1);
scrolling=0;
}
else{mainobj.scrollTop =speed;}
}

function scrollup(f){
if (mainobj.scrollTop<=frameheight*(f-1)){
clearInterval(inter1);
mainobj.scrollTop=frameheight*(f-1);
scrolling=0;
}
else{
mainobj.scrollTop-=speed;
}
}

function slidedown(){
if (scrolling==0){
scrolling=1;
currentF ;
obj=eval("document.all('f" currentF "')");
obj.style.display="block";

inter=eval("setInterval('scrolldown(" currentF ")',5)");
if (currentF == total){
direction = "up";
}

document.all("upbtn").style.display="";
if (currentF==total){
document.all("downbtn").style.display="none";
}
for (i=1;i<=total;i ){
eval("document.all('led" i "').className='NUM1'");
}
eval("document.all('led" currentF "').className='NUM2'");
}
}

function slideup(){
if (scrolling==0){
scrolling=1;
currentF--;
obj=eval("document.all('f" currentF "')");
obj.style.display="block";

inter1=eval("setInterval('scrollup(" currentF ")',5)");
if (currentF == 1){
direction = "down";
}


document.all("downbtn").style.display="";
if (currentF==1){
document.all("upbtn").style.display="none";
}
for (i=1;i<=total;i ){
eval("document.all('led" i "').className='NUM1'");
}
eval("document.all('led" currentF "').className='NUM2'");
}
}

//auto slide
var interval01;
var autotime = 4000;
function autoslide(){
if(direction == "down"){
if (currentF == total-1){
direction = "up";
}
slidedown();
//alert(currentF);
}
else if(direction == "up"){
if (currentF == 2){
direction = "down";
}
slideup();
//alert(currentF);
}

}
function iniautoslide(){
interval01 = setInterval("autoslide()",autotime);
}
iniautoslide();
</script>

查看更多 动易Cms教程  动易Cms模板

共2页上一页12下一页
来源:模板无忧//所属分类:动易Cms教程/更新时间:2006-05-22
相关动易Cms教程