Code for text scrolling up

Source: Internet
Author: User
Tip: you can modify some code before running

<head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><meta name="Copyright" content="" /><meta name="description" content="!" /><meta content="" name="keywords" /><title>Text rolling message advertisement code</title><style type="text/css">Td {font-size: 12px ;}</style></head><body><table width="400" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="15" valign="top"></td> <td width="64">Rolling message:</td> <td width="321"><script>var marqueeContent=new Array(); //滚动主题 marqueeContent[0]='+ 文本向上滚动代码!';marqueeContent[1]='+ 显而易见,最高的效率就是对现有材料的最佳利用。';marqueeContent[2]='+ 自己能解决的事,别花钱,花钱能解决的事,别求人。';marqueeContent[3]='+ 旅行是需要一种心情,更重要的是,需要一种冲动。';marqueeContent[4]='+ 随时用零碎的时间(如等人、排队等)做零碎的事情。';var marqueeInterval=new Array(); //文本向上滚动代码var marqueeId=0;var marqueeDelay=4000;var marqueeHeight=15;function initMarquee() { var str=marqueeContent[0]; document.write('<div id=marqueeBox +marqueeHeight+'px" onmouseover="clearInterval(marqueeInterval[0])" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay)"><div>'+str+'</div></div>'); marqueeId++; marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay); }function startMarquee() { var str=marqueeContent[marqueeId]; marqueeId++; if(marqueeId>=marqueeContent.length) marqueeId=0; if(marqueeBox.childNodes.length==1) { var nextLine=document.createElement('DIV'); nextLine.innerHTML=str; marqueeBox.appendChild(nextLine); } else { marqueeBox.childNodes[0].innerHTML=str; marqueeBox.appendChild(marqueeBox.childNodes[0]); marqueeBox.scrollTop=0; } clearInterval(marqueeInterval[1]); marqueeInterval[1]=setInterval("scrollMarquee()",10); }function scrollMarquee() { marqueeBox.scrollTop++; if(marqueeBox.scrollTop%marqueeHeight==marqueeHeight){ clearInterval(marqueeInterval[1]); } }initMarquee();</script></td> </tr></table></body></html>
Tip: you can modify some code before running

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.