Continuous loop scroll up code

Source: Internet
Author: User
Tags setinterval

<div align= "Center" id= "demo" style= "overflow:hidden;height:200px;width:250px;border:1px solid #6699cc; Font-size:14px;color: #336699 line-height:22px;text-align:left;padding:10px "
    <div ID = "Demo1"
        seamless upward scrolling, compatible with IE and ff<br/>
  computer hardware and software application network <BR/
  Web site: http://www.45it.com<br/>
        focus on computer learning
     </div>
    <div id= "Demo2" ></DIV>
</div>
<script language= "JavaScript" type= "Text/javascript"
<!--
var demo = document.getElementById ("demo");
Var Demo1 = document.getElementById ("Demo1");
var Demo2 = document.getElementById ("Demo2");
Var speed=30;   //scrolling speed value, the greater the value the slower
Var nnn=200/demo1.offsetheight
for (i=0;i<nnn;i++) { demo1.innerhtml+= "<br/>" + demo1.innerhtml}
demo2.innerhtml = demo1.innerhtml   //GLong Demo2 is demo1
function Marquee () {
    if (demo2.offsettop-demo.scrolltop<=0)     //When scrolling to the junction of Demo1 and Demo2
        demo.scrolltop-=demo1.offsetheight    //demo jump to the top
    else{
        demo.scrolltop++    //If horizontal, change all height top to width left
   }
}
var my Mar = SetInterval (marquee,speed);       //Set timer
Demo.onmouseover = function ( {clearinterval (MyMar)}   ///mouse over to clear the timer to achieve the purpose of scrolling stop
Demo.onmouseout = function () {MyMar = SetInterval (Marquee,speed)}    //Reset timer when mouse is moved
;
</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.