<DIV id=marquees>
<table width="135" border="1" height="95" style="border-width: 0px">
<tr>
<td style="border-style: none; border-width: medium">这里为需要滚动的图片</td>
</tr>
</table>
</DIV>
<SCRIPT>
marqueesHeight=870;
stopscroll=false;
with(marquees){
noWrap=true;
style.width=0;
style.height=marqueesHeight;
style.overflowY="hidden";
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
document.write('<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');
function init(){
while(templayer.offsetHeight<marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
setInterval("scrollUp()",10); //注:这里为滚动的速度 数字越大滚动越慢
}
document.body.onload=init;
preTop=0;
function scrollUp(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight+1;
}
}
–>
</SCRIPT>
图片上下滚动 代码 测试可用
发表回复