marquee (垂直)循环滚动的js实现

<script type="text/javascript" language="javascript">
/*My Marquee SCRIPT Start*/
var m_m_p_delay = 40;/*每30ms移动1次*/
var m_m_p_step = 1;/*每次移动1px*/
var m_m_p_pN = 1;/*每次移动1px*/
var m_m_d_id = 'my_marquee_main';/*外容器*/
var m_m_d1_id = 'my_marquee_div1';/*容器1*/
var m_m_d2_id = 'my_marquee_div2';/*容器2*/
var m_m_i_id = 'my_marquee_info';/*位置信息*/

document.getElementById(m_m_d2_id).innerHTML=document.getElementById(m_m_d1_id).innerHTML;

function set_my_marquee_parame(){
    if(document.getElementById(m_m_d2_id).offsetHeight-document.getElementById(m_m_d_id).scrollTop <= m_m_p_pN){
        document.getElementById(m_m_d_id).scrollTop-=document.getElementById(m_m_d1_id).offsetHeight;
    }
    else{
        document.getElementById(m_m_d_id).scrollTop++;
    }
   
    document.getElementById(m_m_i_id).innerHTML='';
    document.getElementById(m_m_i_id).innerHTML+='div.scrollTop:'+document.getElementById(m_m_d_id).scrollTop;
}

var my_marquee_interval=setInterval(set_my_marquee_parame,m_m_p_delay);
document.getElementById(m_m_d_id).onmouseover=function() {clearInterval(my_marquee_interval);};
document.getElementById(m_m_d_id).onmouseout=function() {my_marquee_interval=setInterval(set_my_marquee_parame,m_m_p_delay);};
/*My Marquee SCRIPT End*/
</script>

 

---------------------------------------------

效果 marquee (垂直)循环滚动的js实现

posted @ 2010-03-18 17:44  思考之驴  阅读(563)  评论(0编辑  收藏  举报