Javascript Image text scroll up

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

<script language="javascript">Function Marquee () {this. ID = document. getElementById (arguments [0]); if (! This. ID) {alert ("aaa" + arguments [0] + "bbbb! "); This. ID =-1; return;} this. direction = this. width = this. height = this. delayTime = this. waitTime = this. CTL = this. startID = this. stop = this. mouseOver = 0; this. step = 1; this. timer = 30; this. direarray array = {"top": 0, "up": 0, "bottom": 1, "down": 1, "left": 2, "right": 3 }; if (typeof arguments [1] = "number" | typeof arguments [1] = "string") this. direction = arguments [1]; if (typeof arguments [2] = "Number") this. step = arguments [2]; if (typeof arguments [3] = "number") this. width = arguments [3]; if (typeof arguments [4] = "number") this. height = arguments [4]; if (typeof arguments [5] = "number") this. timer = arguments [5]; if (typeof arguments [6] = "number") this. delayTime = arguments [6]; if (typeof arguments [7] = "number") this. waitTime = arguments [7]; if (typeof arguments [8] = "number") this. scrollStep = Arguments [8]; this. ID. style. overflow = this. ID. style. overflowX = this. ID. style. overflowY = "hidden"; this. ID. noWrap = true; this. isNotOpera = (navigator. userAgent. toLowerCase (). indexOf ("opera") =-1); if (arguments. length> = 7) this. start ();} Marquee. prototype. start = function () {if (this. ID =-1) return; if (this. waitTime <800) this. waitTime = 800; if (this. timer <20) this. timer = 20; if (this. width = 0) this . Width = parseInt (this. ID. style. width); if (this. height = 0) this. height = parseInt (this. ID. style. height); if (typeof this. direction = "string") this. direction = this. direarray array [this. direction. toString (). toLowerCase ()]; this. halfWidth = Math. round (this. width/2); this. halfHeight = Math. round (this. height/2); this. bakStep = this. step; this. ID. style. width = this. width + "px"; this. ID. style. height = thi S. Height + "px"; if (typeof this. ScrollStep! = "Number") this. ScrollStep = this. Direction> 1? This. Width: this. Height; var templateLeft ="<table cellspacing='0' cellpadding='0' ><tr><td noWrap=true >MSCLASS_TEMP_HTML</td><td noWrap=true >MSCLASS_TEMP_HTML</td></tr></table>"; Var templateTop ="<table cellspacing='0' cellpadding='0' ><tr><td>MSCLASS_TEMP_HTML</td></tr><tr><td>MSCLASS_TEMP_HTML</td></tr></table>"; Var msobj = this; msobj. tempHTML = msobj. ID. innerHTML; if (msobj. direction <= 1) {msobj. ID. innerHTML = templateTop. replace (/MSCLASS_TEMP_HTML/g, msobj. ID. innerHTML);} else {if (msobj. scrollStep = 0 & msobj. delayTime = 0) {msobj. ID. innerHTML + = msobj. ID. innerHTML;} else {msobj. ID. innerHTML = templateLeft. replace (/MSCLASS_TEMP_HTML/g, msobj. ID. innerHTML) ;}} var timer = this. timer; var delaytime = this. delayTi Me; var waittime = this. waitTime; msobj. startID = function () {msobj. scroll ()} msobj. continue = function () {if (msobj. mouseOver = 1) {setTimeout (msobj. continue, delaytime);} else {clearInterval (msobj. timerID); msobj. CTL = msobj. stop = 0; msobj. timerID = setInterval (msobj. startID, timer) ;}} msobj. pause = function () {msobj. stop = 1; clearInterval (msobj. timerID); setTimeout (msobj. continue, delaytime);} msobj. begin = fu Nction () {msobj. ClientScroll = msobj. Direction> 1? Msobj. ID. scrollWidth/2: msobj. ID. scrollHeight/2; if (msobj. direction <= 1 & msobj. clientScroll <= msobj. height + msobj. step) | (msobj. direction> 1 & msobj. clientScroll <= msobj. width + msobj. step) {msobj. ID. innerHTML = msobj. tempHTML; delete (msobj. tempHTML); return;} delete (msobj. tempHTML); msobj. timerID = setInterval (msobj. startID, timer); if (msobj. scrollStep <0) return; msobj. ID. onmousemove = f Unction (event) {if (msobj. scrollStep = 0 & msobj. direction> 1) {var event = event | window. event; if (window. event) {if (msobj. isNotOpera) {msobj. eventLeft = event. srcElement. id = msobj. ID. id? Event. offsetX-msobj. ID. scrollLeft: event. srcElement. offsetLeft-msobj. ID. scrollLeft + event. offsetX;} else {msobj. scrollStep = null; return ;}} else {msobj. eventLeft = event. layerX-msobj. ID. scrollLeft;} msobj. direction = msobj. eventLeft> msobj. halfWidth? 3: 2; msobj. absCenter = Math. abs (msobj. halfWidth-msobj. eventLeft); msobj. step = Math. round (msobj. absCenter * (msobj. bakStep * 2)/msobj. halfWidth) ;}} msobj. ID. onmouseover = function () {if (msobj. scrollStep = 0) return; msobj. mouseOver = 1; clearInterval (msobj. timerID);} msobj. ID. onmouseout = function () {if (msobj. scrollStep = 0) {if (msobj. step = 0) msobj. step = 1; return;} msobj. mouseOver = 0; if (msobj. stop = 0) {clearInterval (msobj. timerID); msobj. timerID = setInterval (msobj. startID, timer) ;}} setTimeout (msobj. begin, waittime);} Marquee. prototype. scroll = function () {switch (this. direction) {case 0: this. CTL + = this. step; if (this. CTL> = this. scrollStep & this. delayTime> 0) {this. ID. scrollTop + = this. scrollStep + this. step-this. CTL; this. pause (); return;} else {if (this. ID. scrollTop> = this. clientScroll) {this. ID. scrollTop-= this. clientScroll;} this. ID. scrollTop + = this. step;} break; case 1: this. CTL + = this. step; if (this. CTL> = this. scrollStep & this. delayTime> 0) {this. ID. scrollTop-= this. scrollStep + this. step-this. CTL; this. pause (); return;} else {if (this. ID. scrollTop <= 0) {this. ID. scrollTop + = this. clientScroll;} this. ID. scrollTop-= this. step;} break; case 2: this. CTL + = this. step; if (this. CTL> = this. scrollStep & this. delayTime> 0) {this. ID. scrollLeft + = this. scrollStep + this. step-this. CTL; this. pause (); return;} else {if (this. ID. scrollLeft> = this. clientScroll) {this. ID. scrollLeft-= this. clientScroll;} this. ID. scrollLeft + = this. step;} break; case 3: this. CTL + = this. step; if (this. CTL> = this. scrollStep & this. delayTime> 0) {this. ID. scrollLeft-= this. scrollStep + this. step-this. CTL; this. pause (); return;} else {if (this. ID. scrollLeft <= 0) {this. ID. scrollLeft + = this. clientScroll;} this. ID. scrollLeft-= this. step;} break;} // --></script><style>@charset "utf-8";/* CSS Document */body,h1,h2,h3,h4,h5,h6,p,ul,ol,li,form,img,dl,dt,dd,table,th,td,blockquote,fieldset,div,strong,label,em{margin:0;padding:0;border:0;}ul,ol,li{list-style:none;}input,button{margin:0;font-size:12px;vertical-align:middle;}body{font-size:12px;font-family:Arial, Helvetica, sans-serif; text-align:center; margin:0 auto; }table{border-collapse:collapse;border-spacing:0;}a{color:#333;text-decoration:none;}a:hover{ text-decoration:none; color:#c00;}.area5a{ width:950px; margin:20px auto;}.top01-hot{ background:url(../images/d1-bg04.gif) no-repeat; padding-left:166px; width:784px; float:left; height:37px; overflow:hidden;}.part01-hot{ width:623px; float:left; padding-top:5px;display:inline; text-align:center;}.part01-hot a{ margin:0 6px; color:#fff;}.part02-hot{float:right; padding-right:11px; width:150px; padding-top:10px; text-align:right;}.part02-hot a{ color:#36c;}.part02-hot a.more{ padding-left:4px; margin-left:5px; background:url(../images/line03.gif) no-repeat left 0;}.mid01-hot{ background:url(../images/d1-bg05.gif) repeat-y; width:100%; height:176px; overflow:hidden; float:left;}.shopPH {MARGIN-TOP: 10px; POSITION: relative; HEIGHT: 217px}.bd {padding-left:15px; }.bd LI {float: left; width: 298px; padding-top: 8px; height: 72px; _display: inline}.bd LI .pic {FLOAT: left; WIDTH: 153px; TEXT-ALIGN: left}.bd LI .pic img { border: #e2e2e2 1px solid; padding: 3px; display: block; width: 135px; height: 60px; }.bd LI .info {float: left; width: 145px; text-align:left;}.bd LI .info h3{ padding-top:2px; height:19px; overflow: hidden;}.bd LI .info h3 a{ font-size:12px; font-weight:normal; color:#36c;}.bd LI .info p.star {color: #888; height:23px;}.bd LI .info p.menu a{ display:block; background:url(../images/bg01.gif) no-repeat; width:101px; height:23px; text-align:center; line-height:23px;color:#36c;}.bd LI .info p.menu a:hover{ color:#f30;}.bot01-hot{ background:url(../images/d1-bg06.gif) no-repeat; width:100%; height:5px; overflow:hidden; float:left;}</style><div class="area5a"><div class="top01-hot"><div class="part01-hot"><a >Leisure and Entertainment<a >Food & Beverage<a >Convenient life<a >Travel<a >Shopping World<a >Education and Training<a >Decoration<a >Automotive World<a >Other categories</div><div class="part02-hot"><a >Merchants enter more merchants</div></div><div class="mid01-hot"><div class=shopPH><div class="bd clearfix"><div id=marqueediv1><ul><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li><li><div class=pic></div><div class=info><H3><A >Beijing Hua Xu digital counter</a></h3><P class=star>Discount: Discount</p><P class=menu>Enter My Shop & raquo;</p></div></li> </ul> </div><SCRIPT type=text/javascript>New Marquee ("marqueediv1", 930,160, 80 );</sCRIPT></div></div></div><div class="bot01-hot"></div></div></td> </tr></table>
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.