Tag Archives: js
滚动框,直接开始
大家经常使用滚动框,其中,如何才能开始没有那部分空白?
代码如下:
<DIV id="marquees" align=left>
<a href="http://">欢迎</a><BR>
<br><BR><br>
</DIV>
<script language="JavaScript">
marqueesHeight=50;
stopscroll=false;
with(marquees){
style.width=140;
style.height=marqueesHeight;
style.overflowX="visible";
style.overflowY="hidden";
noWrap=false;
onmouseover=new Function("stopscroll=true");
onmouseout=new Function("stopscroll=false");
}
document.write(‘<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>’);
preTop=0; currentTop=0;
function init(){
templayer.innerHTML="";
while(templayer.offsetHeight<marqueesHeight){
templayer.innerHTML+=marquees.innerHTML;
}
marquees.innerHTML=templayer.innerHTML+templayer.innerHTML;
setInterval("scrollUp()",80);
// MM_openBrWindow(‘news/pg.php’,’news’,’width=288,height=139′);
// MM_openBrWindow(‘news/wlj.htm’,’news’,’width=300,height=220′);
// MM_openBrWindow(‘newyear/chunjie_2004.htm’,’news’,’width=300,height=330′);
// MM_openBrWindow(‘newyear/chunjie_2005.htm’,’news’,’width=300,height=330′);
// MM_openBrWindow(‘newyear/yuandan2005.htm’,’news’,’width=800,height=500,scrollbars=yes’);
// MM_openBrWindow(‘http://news.dlut.edu.cn/news_displa … amp;lanmu_id=100′,’news’);
}
document.body.onload=init;
function scrollUp(){
if(stopscroll==true) return;
preTop=marquees.scrollTop;
marquees.scrollTop+=1;
if(preTop==marquees.scrollTop){
marquees.scrollTop=templayer.offsetHeight-marqueesHeight;
marquees.scrollTop+=1;
}
}
</script>