/**********
功能:實現水平或垂直無縫滾動
參數:direction方向,總共4個值:left,right,top,bottom
多少時間後開始移動,若不寫則頁面載入完開始移動
**********/
函數滾動(方向,速度,iTime){
var oDiv = document.getElementById('scroll');
Div. getElementsByTagName('ul')[0];
var aLi = oDiv.getElementsByTagName('li');
var aBtn = oDiv.getElementsByTagName('a'); > var iSpeed = 0;
var flag = true; //判斷水平移動或垂直移動
oUl.innerHTML = oUl.innerHTML;
oUl.innerHTML = oUl.innerHTML;
oUl.innerHTML = oUl.innerHTML;
>>> case 'left':
iSpeed = -speed;
oUl.style.width = aLi[0].set.W oUl.style.width = aLi[0].set.W oUl.style.width = aLi[0].set.W flag = true;
break;
case 'right':
iSpeed =速度;
flag = true;
break;
case 'top':
iSpeed = -速度;
🎜> case 'bottom':
iSpeed = speed;
iSpeed = speed;
iSpeed = speed;
> break;
};
setTimeout(move,iTime);
clearInterval(timer);
iSpeed = -speed;
aBtn[1].onclick = function (){
clearInterval(timer);
iSpeed = 速度;
move(); clearInterval(timer );
};
oUl .onmouseout = function(){
move( 🎜> 計時器= setInterval(function(){
if(oUl.offsetLeft
-oUl.offsetWidth / 2){
oUl.style.left = '0';
oUl.style .left = - oUl.offsetWidth / 2 'px';
}else{
oUl.style.top = oUl.offsetTop iSpeed 'px';
{
oUl.style.top = '0';
}else if(oUl.offsetTop >= 0){
};
};
);
};
};
要注意的是:html 結構必須要像上面的結構。