Scroll the JavaScript code to the left

Source: Internet
Author: User

Copy codeThe Code is as follows:
<Html>
<Head>
<Title> scroll text effect </title>
<Style type = "text/css">
# Infozone {font-size: 12px; color: # aa6; overflow: hidden; width: 100px; height: 20px ;}
# Infozone div {height: 20px; line-height: 20px; white-space: nowrap; overflow: hidden ;}
</Style>
<Script type = "text/javascript">
Var tc;
Window. onload = function (){
Var o = document. getElementById ('infozone '); hscroll (o );
Window. setInterval (function () {window. clearTimeout (tc); o. firstChild. style. marginLeft = '0px '; scrollup (o, 20, 0);}, 10000 );
}
Function scrollup (o, d, c ){
If (d = c ){
Var t = o. firstChild. cloneNode (true );
O. removeChild (o. firstChild); o. appendChild (t );
T. style. marginTop = o. firstChild. style. marginTop = '0px ';
Hscroll (o );
}
Else {
Ch = false; var s = 3, c = c + s, l = (c> = d? C-d: 0 );
O. firstChild. style. marginTop =-c + l + 'px ';
Window. setTimeout (function () {scrollup (o, d, c-l)}, 50 );
}
}

Function hscroll (o ){
Var w1 = o. firstChild. offsetWidth, w2 = o. offsetWidth;
If (w1 <= w2) return;
Tc = window. setTimeout (function () {hs (o, w1-w2, 0, w1-w2)}, 3500 );
}

Function hs (o, d, c, p ){
C ++; var t = (c> 0? -C: c); o. firstChild. style. marginLeft = t + 'px ';
If (c = d) {if (d = 0) {tc = window. setTimeout (function () {hs (o, p, 0, p) }, 2500);} else tc = window. setTimeout (function () {hs (o, 0,-p, p)}, 3500 );}
Else tc = window. setTimeout (function () {hs (o, d, c, p)}, 5 );
}
</Script>
</Head>

<Body>
<Div id = "infozone"> <div> C # source code examples for dynamic operations on mouse Properties, for example, hiding and displaying the mouse pointer, switching the left and right mouse keys, changing the mouse pointer shape, and calling the Windows mouse to set the panel. </Div>
</Body>
</Html> </td>
</Tr>
</Table>

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.