是一个图片滚动的代码。其中的这一句怎么也不明白,尤其是一个*-1,给指导一下啊,。各位大佬!
- JScript code
function move1(whichdiv) { tdiv=eval(whichdiv) if (tdiv.style.pixelTop>0&&tdiv.style.pixelTop<=car_num) //如果顶部的距离大于零并且小于每次移动的距离的话,就直接使顶部距离为0. { tdiv.style.pixelTop=0 setTimeout("move1(tdiv)",pausebetweenimages) setTimeout("move2(second2)",pausebetweenimages) return } if (tdiv.style.pixelTop>=tdiv.offsetHeight*-1) //不明白这句话的意思。 { tdiv.style.pixelTop-=car_num setTimeout("move1(tdiv)",50) } else { tdiv.style.pixelTop=scrollheight tdiv.innerHTML=slideimages[0] if (i==slideimages.length-1) i=0 else i++ } } function move2(whichdiv) { tdiv2=eval(whichdiv) if (tdiv2.style.pixelTop>0&&tdiv2.style.pixelTop<=car_num) { tdiv2.style.pixelTop=0 setTimeout("move2(tdiv2)",pausebetweenimages) setTimeout("move1(first2)",pausebetweenimages) return } if (tdiv2.style.pixelTop>=tdiv2.offsetHeight*-1) { tdiv2.style.pixelTop-=car_num setTimeout("move2(second2)",50) } else { tdiv2.style.pixelTop=scrollheight tdiv2.innerHTML=slideimages[1] if (i==slideimages.length-1) i=0 else i++ } } function conmouse(){car_num=0;} //鼠标经过时图片停止 function cmouseout(){car_num=5;} //鼠标离开时继续按原来的速度上移。 function startscroll() { move1(first2) second2.style.top=scrollheight } </SCRIPT>
------解决方案--------------------
帮你顶!