维维

首页 新随笔 联系 订阅 管理
<div id="marqueey">
希望各位能够喜欢
<br/>
再次谢谢各位光临
<br/>
</div>
<script language="JavaScript">
marqueeyHeight
=140;    //载体高度控制
stopscroll=false;
with(marqueey){
    style.width
=0;
    style.height
=marqueeyHeight;
    style.overflowX
="visible";
    style.overflowY
="hidden";
    noWrap
=true;
    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<marqueeyHeight){
        templayer.innerHTML
+=marqueey.innerHTML;
    }

    marqueey.innerHTML
=templayer.innerHTML+templayer.innerHTML;
    setInterval(
"scrollUp()",40);    //滚动速度控制,越大越慢
}

document.body.onload
=init;
function scrollUp(){
    
if(stopscroll==truereturn;
    preTop
=marqueey.scrollTop;
    marqueey.scrollTop
+=1;
    
if(preTop==marqueey.scrollTop){
        marqueey.scrollTop
=templayer.offsetHeight-marqueeyHeight;
        marqueey.scrollTop
+=1;
    }

}

</script>
垂直

<div id="marqueex">
 希望各位能够喜欢 再次谢谢各位光临
</div>

<script language="JavaScript">
marqueexWidth
=600;    //载体宽度控制
with(marqueex){
    style.height
=0;
    style.width
=marqueexWidth;
    style.overflowX
="hidden";
    style.overflowY
="visible";
    noWrap
=true;
    onmouseover
=new Function("stopscroll=true");
    onmouseout
=new Function("stopscroll=false");
}

document.write('
<div id="templayer" style="position:absolute;z-index:1;visibility:hidden"></div>');
preLeft
=0; currentLeft=0; stopscroll=false;

function init(){
    templayer.innerHTML
="";
    
while(templayer.offsetWidth<marqueexWidth){
        templayer.innerHTML
+=marqueex.innerHTML;
    }

    marqueex.innerHTML
+=templayer.innerHTML;
    setInterval(
"scrollLeft()",40);    //滚动速度控制,越大越慢
}

document.body.onload
=init;
function scrollLeft(){
    
if(stopscroll==truereturn;
    preLeft
=marqueex.scrollLeft;
    marqueex.scrollLeft
+=1;
    
if(preLeft==marqueex.scrollLeft){
        marqueex.scrollLeft
=templayer.offsetWidth-marqueexWidth+1;
    }

}

</script>
水平
posted on 2006-01-17 11:17  维维  阅读(206)  评论(0编辑  收藏  举报