Javascript simulates Marquee text to scroll evenly to the left. Code _ special text effects

Source: Internet
Author: User
Marquee is a fixed text rolling label in HTML. Although it is easy to use, there are some functional limitations. In many cases, we use JavaScript to supplement this function. this Code enables constant speed, seamless, link addition, and other modifier effects. This function enables smooth scrolling of text from right to right, you can set the scroll width, height, and speed.

<HTML> <HEAD> <META http-equiv = 'content-type' Content = 'text/html; charset = gb2312 '> <TITLE> JavaScript text moves left </TITLE> </HEAD> <BODY> <script language = "JavaScript1.2"> var marqueewidth = 350 var marqueeheight = 22 var speed = 5 var marqueecontents = '<strong> <big> welcome to the special effect section on the home page, all high-quality special effects are collected! </Big> </strong> 'if (document. all) document. write ('<marquee scrollAmount =' + speed + 'style = "width: '+ marqueewidth +'"> '+ marqueecontents +' </marquee> ') function regenerate () {window. location. reload ()} function regenerate2 () {if (document. layers) {setTimeout ("window. onresize = regenerate ", 450) intializemarquee ()} function intializemarquee () {document.cmarquee01.document.cmarquee02.doc ument. write ('<nobr>' + marqueecontents + '</nobr>') document.cmarquee01.document.cmarquee02.doc ument. close () thelength1_document.cmarquee01.document.cmarquee02.doc ument. width scrollit ()} function scrollit () {if (document.cmarquee01.doc ument. cmarquee02.left> = thelength * (-1) {document.cmarquee01.doc ument. cmarquee02.left-= speed setTimeout ("scrolout ()", 100)} else {document.cmarquee01.doc ument. cmarquee02.left = marqueewidth scrolwidth ()} window. onload = regenerate2 script <ilayer width = & {marqueewidth}; height = & {marqueeheight }; name = "cmarquee01"> <layer name = "cmarquee02"> </layer> </ilayer> </BODY> </HTML>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]

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.