ID:30776691
大小:73.00 KB
页数:6页
时间:2019-01-03
6、取div标签functiongetobj(element)returndocument・getElementByld(element);}〃声明div标签变量vartoplabel=getobj("label2");varbottomlabel=getobj("label3");〃定义div标签长度常量MAX_HEIGHT=80;MIN_HEIGHT=1;〃声明并初始化变量vart;//计时器varspeed=5;//滚动速度varheight=MAX_HEIGHT;//topdiv长度varbotto
7、mheight=MIN_HEIGHT;//bottomdiv长度bottomlabel.innerHTML=toplabel.innerHTML;//复制top内容到bottom,用來循环滚动显示functionmove()〃当top滚动值scrollTop+offsetHeight等于topdiv的scrollHeight时。topdiv停止滚动,并减少topdiv的style.height值if((toplabe1・scrollTop+toplabe1・offsetHeight)>=toplabel
8、・scrollHeight){toplabe1・style.height二heigh=speed;bottomlabel・style・height二bottomheight+=speed;//减少topheigth并同步增加bottomheight,这样,可以实现无缝滚动。if(height
此文档下载收益归作者所有