Div + CSS text scroll up

Source: Internet
Author: User

<Div id = "marquees">
<A href = "#"> you have had countless dreams. </a> <br>
<Br>
<A href = "#"> however, it is lost in the passage of time </a> <br>
<Br>
<A href = "#"> have you ever looked forward to the future? </a> <br>
<Br>
<A href = "#"> lost in the years of growth </a> <br>
<Br>

</Div>

</Div>
<Script language = "JavaScript">
Marqueesheight = 200;
Stopscroll = false;
With (marquees ){
Style. width = 0;
Style. Height = marqueesheight;
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 <marqueesheight ){
Templayer. innerhtml + = marquees. innerhtml;
}
Marquees. innerhtml = templayer. innerhtml + templayer. innerhtml;
Setinterval ("scrollup ()", 10 );
}
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>

Related Article

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.