谁能研究下这两个MSClass.js的区别!

2016-07-07 16:19 来源:www.chinab4c.com 作者:ecshop专家

第二个:
  1. function Marquee()
  2. {
  3. this.ID = document.getElementById(arguments[0]);

  4. this.Direction = arguments[1];
  5. this.Step = arguments[2];
  6. this.Width = arguments[3];
  7. this.Height = arguments[4];
  8. this.Timer = arguments[5];
  9. this.WaitTime = arguments[6];
  10. this.StopTime = arguments[7];
  11. if(arguments[8])
  12. this.ScrollStep = arguments[8]
  13. else
  14. this.ScrollStep = this.Direction>1 ? this.Width : this.Height;
  15. this.CTL = this.StartID = this.Stop = this.MouseOver = 0;
  16. this.ID.style.overflowX = this.ID.style.overflowY = "hidden";
  17. this.ID.noWrap = true;
  18. this.ID.style.width = this.Width;
  19. this.ID.style.height = this.Height;
  20. this.ClientScroll = this.Direction>1 ? this.ID.scrollWidth : this.ID.scrollHeight;
  21. this.ID.innerHTML += this.ID.innerHTML;
  22. this.Start(this,this.Timer,this.WaitTime,this.StopTime);
  23. }
  24. Marquee.prototype.Start = function(msobj,timer,waittime,stoptime)
  25. {
  26. msobj.StartID = function(){msobj.Scroll()}
  27. msobj.Continue = function()
  28. {
  29. if(msobj.MouseOver == 1)
  30. {
  31. setTimeout(msobj.Continue,waittime);
  32. }
  33. else
  34. { clearInterval(msobj.TimerID);
  35. msobj.CTL = msobj.Stop = 0;
  36. msobj.TimerID = setInterval(msobj.StartID,timer);
  37. }
  38. }
  39. msobj.Pause = function()
  40. {
  41. msobj.Stop = 1;
  42. clearInterval(msobj.TimerID);
  43. setTimeout(msobj.Continue,waittime);
  44. }
  45. msobj.Begin = function()
  46. {
  47. msobj.TimerID = setInterval(msobj.StartID,timer);
  48. msobj.ID.onmouseover = function()
  49. {
  50. msobj.MouseOver = 1;
  51. clearInterval(msobj.TimerID);
  52. }
  53. msobj.ID.onmouseout = function()
  54. {
  55. msobj.MouseOver = 0;
  56. if(msobj.Stop == 0)
  57. {
  58. clearInterval(msobj.TimerID);
  59. msobj.TimerID = setInterval(msobj.StartID,timer);
  60. }
  61. }
  62. }
  63. setTimeout(msobj.Begin,stoptime);
  64. }
  65. Marquee.prototype.Scroll = function()
  66. {
  67. switch(this.Direction)
  68. {
  69. case 0:
  70. this.CTL += this.Step;
  71. if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
  72. {
  73. this.ID.scrollTop += this.ScrollStep + this.Step - this.CTL;
  74. this.Pause();
  75. return;
  76. }
  77. else
  78. {
  79. if(this.ID.scrollTop >= this.ClientScroll)
  80. {
  81. this.ID.scrollTop -= this.ClientScroll;
  82. }
  83. this.ID.scrollTop += this.Step;
  84. }
  85. break;
  86. case 1:
  87. this.CTL += this.Step;
  88. if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
  89. {
  90. this.ID.scrollTop -= this.ScrollStep + this.Step - this.CTL;
  91. this.Pause();
  92. return;
  93. }
  94. else
  95. {
  96. if(this.ID.scrollTop <= 0)
  97. {
  98. this.ID.scrollTop += this.ClientScroll;
  99. }
  100. this.ID.scrollTop -= this.Step;
  101. }
  102. break;
  103. case 2:
  104. this.CTL += this.Step;
  105. if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
  106. {
  107. this.ID.scrollLeft += this.ScrollStep + this.Step - this.CTL;
  108. this.Pause();
  109. return;
  110. }
  111. else
  112. {
  113. if(this.ID.scrollLeft >= this.ClientScroll)
  114. {
  115. this.ID.scrollLeft -= this.ClientScroll;
  116. }
  117. this.ID.scrollLeft += this.Step;
  118. }
  119. break;
  120. case 3:
  121. this.CTL += this.Step;
  122. if(this.CTL >= this.ScrollStep && this.WaitTime > 0)
  123. {
  124. this.ID.scrollLeft -= this.ScrollStep + this.Step - this.CTL;
  125. this.Pause();
  126. return;
  127. }
  128. else
  129. {
  130. if(this.ID.scrollLeft <= 0)
  131. {
  132. this.ID.scrollLeft += this.ClientScroll;
  133. }
  134. this.ID.scrollLeft -= this.Step;
  135. }
  136. break;
  137. }
  138. }
复制代码

回答:
没高人吗,独自等待!

顶上去让大侠们看见!或者我该改成求助帖!

这个滚动程序是封装好的,都可以兼容的。去下个最新版本,站点是http://www.popub.net/script/MSClass.html