1<!-- 2/*MSClass (Class Of Marquee Scrolléç¨ä¸é´ææ»å¨JSå°è£ ç±») Ver 1.6*\ 3 4ãå¶ä½æ¶é´:2006-08-29 (Ver 0.5) 5ãå叿¶é´:2006-08-31 (Ver 0.8) 6ãæ´æ°æ¶é´:2007-01-31 (Ver 1.6) 7ãæ´æ°è¯´æ: + å å ¥åè½ * ä¿®æ£ãå®å 8 1.6.070131 9 + ç¦æ¢é¼ æ æ§å¶æåæç»§ç» (å°ç¬¬9ä¸ªåæ°è®¾ç½®ä¸º-1æè 卿èµå¼å°ScrollSetp设置为-1) 10 + 夿æ¯å¦å¯ä»¥æ»å¨ (è¥å 容åºåå°äºæ¾ç¤ºåºå,åèªå¨åæ¶æ»å¨) 11 + è·³è¿åå§åé误 (é¿å å¼èµ·å ¶å®æ»å¨ç忢) 12 + é»è®¤å¼ (é¤å®¹å¨IDå¿ éå¤ï¼å ¶ä»åæ°å坿 ¹æ®æ åµè¿è¡éæ©è®¾ç½®) 13 + 忰卿èµå¼ (æ¹åå¯ç¨è±æè¡¨ç¤ºtop|bottom|left|right,ä½¿å ¶æ´ç´è§ãæ¹ä¾¿) 14 * æåæ»å¨ä¸åç¡® (æ¬æ¬¡æ´æ°ä¸»è¦ç®çè§£å³æ¤Bug,æè°¢å¨çºå䏿µè¯) 15 1.4.061211 16 + é¼ æ æ¬åæ¹åæ»å¨æ¹å (é¼ æ æ¬åæ§å¶å·¦å³æ»å¨) 17 * ç±äºææ¡£ä¸è½½è¿æ ¢è导è´è·åçé«åº¦/宽度ä¸åç¡® 18 * æµè§å¨å ¼å®¹é®é¢ (IEãFFãOperaãNSãMYIE) 19 1.2.060922 20 + æå®èå´é´ææ»å¨ 21 * ç¨åºè°æ´ 22 * è¿ç»é´ææ»å¨åæ¢çé误 23 1.0.060901 24 + åä¸ãå峿»å¨ 25 + å¼å§çå¾ æ¶é´ 26 + è¿ç»æ»å¨ 27 * è°æ´æ¶é´åä½ 28 * æ»å¨è¯¯å·® 29 * éæºæ»å¾ªç¯ 30 * å 强æ§è½ 31 * ç¨åºä¼å 32 0.8.060829 33 ç¿»å±ä¸é´æåä¸ãåå·¦æ»å¨ 34 35ãæ¼ç¤ºå°å:http://www.popub.net/script/MSClass.html 36ãä¸è½½å°å:http://www.popub.net/script/MSClass.js 37 38ãåºç¨è¯´æ:页é¢å å«<script type="text/javascript" src="MSClass.js"></script> 39 40 å建å®ä¾: 41 //åæ°ç´æ¥èµå¼æ³ 42 new Marquee("marquee") 43 new Marquee("marquee","top") 44 ...... 45 new Marquee("marquee",0,1,760,52) 46 new Marquee("marquee","top",1,760,52,50,5000) 47 ...... 48 new Marquee("marquee",0,1,760,104,50,5000,3000,52) 49 new Marquee("marquee",null,null,760,104,null,5000,null,-1) 50 51 //忰卿èµå¼æ³ 52 var marquee1 = new Marquee("marquee") *æ¤åæ°å¿ é 53 marquee1.Direction = "top"; æè marquee1.Direction = 0; 54 marquee1.Step = 1; 55 marquee1.Width = 760; 56 marquee1.Height = 52; 57 marquee1.Timer = 50; 58 marquee1.DelayTime = 5000; 59 marquee1.WaitTime = 3000; 60 marquee1.ScrollStep = 52; 61 marquee1.Start(); 62 63 åæ°è¯´æ: 64 ID "marquee" 容å¨ID (å¿ é) 65 Direction (0) æ»å¨æ¹å (å¯é,é»è®¤ä¸º0å䏿»å¨) å¯è®¾ç½®çå¼å æ¬:0,1,2,3,"top","bottom","left","right" (0åä¸ 1åä¸ 2åå·¦ 3åå³) 66 Step (1) æ»å¨çæ¥é¿ (å¯é,é»è®¤å¼ä¸º2,æ°å¼è¶å¤§,æ»å¨è¶å¿«) 67 Width (760) 容å¨å¯è§å®½åº¦ (å¯é,é»è®¤å¼ä¸ºå®¹å¨åå§è®¾ç½®ç宽度) 68 Height (52) 容å¨å¯è§é«åº¦ (å¯é,é»è®¤å¼ä¸ºå®¹å¨åå§è®¾ç½®çé«åº¦) 69 Timer (50) 宿¶å¨ (å¯é,é»è®¤å¼ä¸º30,æ°å¼è¶å°,æ»å¨çé度è¶å¿«,1000=1ç§,建议ä¸å°äº20) 70 DelayTime (5000) é´æåé¡¿å»¶è¿æ¶é´(å¯é,é»è®¤ä¸º0ä¸åé¡¿,1000=1ç§) 71 WaitTime (3000) å¼å§æ¶ççå¾ æ¶é´(å¯é,é»è®¤æ0为ä¸çå¾ ,1000=1ç§) 72 ScrollStep (52) é´ææ»å¨é´è· (å¯é,é»è®¤ä¸ºç¿»å±å®½/é«åº¦,该æ°å¼ä¸å»¶è¿å为0åä¸ºé¼ æ æ¬åæ§å¶,-1ç¦æ¢é¼ æ æ§å¶) 73ã使ç¨å»ºè®®: 74 1ãå»ºè®®ç´æ¥èµäºå®¹å¨çæ¾ç¤ºåºåç宽度åé«åº¦ï¼å¦(<div id="marquee" style="width:760px;height:52px;">......</div>) 75 2ãå»ºè®®ä¸ºå®¹å¨æ·»å æ ·å¼overflow = autoï¼å¦(<div id="marquee" style="width:760px;height:52px;overflow:auto;">......</div>) 76 3ãä¸ºäºæ´åç¡®çè·åæ»å¨åºåç宽度åé«åº¦ï¼è¯·å°½å¯è½å°åæ»å¨åä½ç´æ¥èµäºæ£ç¡®å®½é«åº¦ 77 4ã对äºTABLEæ è®°çæ¨ªåæ»å¨ï¼éè¦å¯¹TABLEæ·»å æ ·å¼display = inlineï¼å¦(<div id="marquee" style="width:760px;height:52px;overflow:auto;"><table style="display:inline">......</table></div>) 78 5ã对äºç¿»å±æ»å¨æé´ææ»å¨ï¼è¦æ³¨æåæ»å¨åä½é´çé´è·ï¼åæ¶éè¦å¯¹å®¹å¨çå¯è§é«åº¦åå¯è§å®½åº¦å好åç¡®ç设置ï¼å¯¹äºåæ»å¨åä½é´çé´è·å¯ä»¥éè¿è®¾ç½®è¡é´è·æè åå æ ¼çé«å®½åº¦æ¥è¿è¡è°æ´ 79 6ã对äºLIèªå¨æ¢è¡çé®é¢ææ¶æ²¡ææ´å¥½çè§£å³åæ³ï¼å»ºè®®å°å ¶è½¬æ¢æè¡¨æ ¼(TABLE)ç形弿¥è¾¾å°åççææ 80 7ãéå¯¹æ¨ªåæ»å¨çæå段è½ï¼å¦æææ«ç«¯æ¯ä»¥ç©ºæ ¼" "ç»æçï¼è¯·å°ç©ºæ ¼" "è½¬æ¢æ" " 81 8ãé¼ æ æ¬åæ»å¨ææ³æºèªFlashï¼æä»¥æä¸å®çå±éæ§ï¼
81容å¨å ä» å 许ç¨å¾ç<img>æè 另龿¥çå¾ç<a><img></a>çå½¢å¼ï¼å¹¶éè¦ç¦æ¢å ¶èªå¨æ¢è¡ï¼ 82 83ãæããè°¢: 84 å¨çº zhoujun#yuchengtech.com (æåæ»å¨è·³è¡çbug) 2007/01/31 85 èªæ¬ç¨åºåå¸ä»¥æ¥ï¼æ¶å°ä¸å°æåçé®ä»¶ï¼æåºäºå¾å¤æè§åå»ºè®®ï¼æè°¢å¤§å®¶çæ¯æï¼ 86 87\***ç¨åºå¶ä½/çæææ:å´æ°¸ç¥¥(333) E-Mail:[email protected] ç½å:http://www.popub.net***/ 88 89 90function Marquee() 91{ 92 this.ID = document.getElementById(arguments[0]); 93 if(!this.ID) 94 { 95 alert("æ¨è¦è®¾ç½®ç\"" + arguments[0] + "\"åå§åé误\r\nè¯·æ£æ¥æ ç¾ID设置æ¯å¦æ£ç¡®!"); 96 this.ID = -1; 97 return; 98 } 99 this.Direction = this.Width = this.Height = this.DelayTime = this.WaitTime = this.Correct = this.CTL = this.StartID = this.Stop = this.MouseOver = 0; 100 this.Step = 1; 101 this.Timer = 30; 102 this.DirectionArray = {"top":0 , "bottom":1 , "left":2 , "right":3}; 103 if(typeof arguments[1] == "number" || typeof arguments[1] == "string")this.Direction = arguments[1]; 104 if(typeof arguments[2] == "number")this.Step = arguments[2]; 105 if(typeof arguments[3] == "number")this.Width = arguments[3]; 106 if(typeof arguments[4] == "number")this.Height = arguments[4]; 107 if(typeof arguments[5] == "number")this.Timer = arguments[5]; 108 if(typeof arguments[6] == "number")this.DelayTime = arguments[6]; 109 if(typeof arguments[7] == "number")this.WaitTime = arguments[7]; 110 if(typeof arguments[8] == "number")this.ScrollStep = arguments[8] 111 this.ID.style.overflow = this.ID.style.overflowX = this.ID.style.overflowY = "hidden"; 112 this.ID.noWrap = true; 113 this.IsNotOpera = (navigator.userAgent.toLowerCase().indexOf("opera") == -1); 114 if(arguments.length >= 7)this.Start(); 115} 116 117 118Marquee.prototype.Start = function() 119{ 120 if(this.ID == -1)return; 121 if(this.WaitTime < 800)this.WaitTime = 800; 122 if(this.Timer < 20)this.Timer = 20; 123 if(this.Width == 0)this.Width = parseInt(this.ID.style.width); 124 if(this.Height == 0)this.Height = parseInt(this.ID.style.height); 125 if(typeof this.Direction == "string")this.Direction = this.DirectionArray[this.Direction.toString().toLowerCase()]; 126 this.HalfWidth = Math.round(this.Width / 2); 127 this.HalfHeight = Math.round(this.Height / 2); 128 this.BakStep = this.Step; 129 this.ID.style.width = this.Width + "px"; 130 this.ID.style.height = this.Height + "px"; 131 if(typeof this.ScrollStep != "number")this.ScrollStep = this.Direction > 1 ? this.Width : this.Height; 132 var msobj = this; 133 var timer = this.Timer; 134 var delaytime = this.DelayTime; 135 var waittime = this.WaitTime; 136 msobj.StartID = function(){msobj.Scroll()} 137 msobj.Continue = function() 138 { 139 if(msobj.MouseOver == 1) 140 { 141 setTimeout(msobj.Continue,delaytime); 142 } 143 else 144 { clearInterval(msobj.TimerID); 145 msobj.CTL = msobj.Stop = 0; 146 msobj.TimerID = setInterval(msobj.StartID,timer); 147 } 148 } 149 150 msobj.Pause = function() 151 { 152 msobj.Stop = 1; 153 clearInterval(msobj.TimerID); 154 setTimeout(msobj.Continue,delaytime); 155 } 156 157 msobj.Begin = function() 158 { 159 msobj.ClientScroll = msobj.Direction > 1 ? msobj.ID.scrollWidth : msobj.ID.scrollHeight; 160 if((msobj.Direction <= 1 && msobj.ClientScroll <= msobj.Height + msobj.Step) || (msobj.Direction > 1 && msobj.ClientScroll <= msobj.Width + msobj.Step))return; 161 msobj.ID.innerHTML += msobj.ID.innerHTML; 162 msobj.TimerID = setInterval(msobj.StartID,timer); 163 if(msobj.ScrollStep < 0)return; 164 msobj.ID.onmousemove = function(event) 165 { 166 if(msobj.ScrollStep == 0 && msobj.Direction > 1) 167 { 168 var event = event || window.event; 169 if(window.event) 170 { 171 if(msobj.IsNotOpera) 172 { 173 msobj.EventLeft = event.srcElement.id == msobj.ID.id ? event.offsetX - msobj.ID.scrollLeft : event.srcElement.offsetLeft - msobj.ID.scrollLeft + event.offsetX; 174 } 175 else 176 { 177 msobj.ScrollStep = null; 178 return; 179 } 180 } 181 else 182 { 183 msobj.EventLeft = event.layerX - msobj.ID.scrollLeft; 184 } 185 msobj.Direction = msobj.EventLeft > msobj.HalfWidth ? 3 : 2; 186 msobj.AbsCenter = Math.abs(msobj.HalfWidth - msobj.EventLeft); 187 msobj.Step = Math.round(msobj.AbsCenter * (msobj.BakStep*2) / msobj.HalfWidth); 188 } 189 } 190 msobj.ID.onmouseover = function() 191 { 192 if(msobj.ScrollStep == 0)return; 193 msobj.MouseOver = 1; 194 clearInterval(msobj.TimerID); 195 } 196 msobj.ID.onmouseout = function() 197 { 198 if(msobj.ScrollStep == 0) 199 { 200 if(msobj.Step == 0)msobj.Step = 1; 201 return; 202 } 203 msobj.MouseOver = 0; 204 if(msobj.Stop == 0) 205 { 206 clearInterval(msobj.TimerID); 207 msobj.TimerID = setInterval(msobj.StartID,timer); 208 } 209 } 210 } 211 setTimeout(msobj.Begin,waittime); 212} 213 214Marquee.prototype.Scroll = function() 215{ 216 switch(this.Direction) 217 { 218 case 0: 219 this.CTL += this.Step; 220 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 221 { 222 this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL; 223 this.Pause(); 224 return; 225 } 226 else 227 {
228 if(this.ID.scrollTop >= this.ClientScroll) 229 { 230 this.ID.scrollTop -= this.ClientScroll; 231 } 232 this.ID.scrollTop += this.Step; 233 } 234 break; 235 236 case 1: 237 this.CTL += this.Step; 238 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 239 { 240 this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL; 241 this.Pause(); 242 return; 243 } 244 else 245 { 246 if(this.ID.scrollTop <= 0) 247 { 248 this.ID.scrollTop += this.ClientScroll; 249 } 250 this.ID.scrollTop -= this.Step; 251 } 252 break; 253 254 case 2: 255 this.CTL += this.Step; 256 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 257 { 258 this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL; 259 this.Pause(); 260 return; 261 } 262 else 263 { 264 if(this.ID.scrollLeft >= this.ClientScroll) 265 { 266 this.ID.scrollLeft -= this.ClientScroll; 267 } 268 this.ID.scrollLeft += this.Step; 269 } 270 break; 271 272 case 3: 273 this.CTL += this.Step; 274 if(this.CTL >= this.ScrollStep && this.DelayTime > 0) 275 { 276 this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL; 277 this.Pause(); 278 return; 279 } 280 else 281 { 282 if(this.ID.scrollLeft <= 0) 283 { 284 this.ID.scrollLeft += this.ClientScroll; 285 } 286 this.ID.scrollLeft -= this.Step; 287 } 288 break; 289 } 290} 291//-->
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.