兼容多浏览器的无缝左滚动

  <!--兼容性滚动-->
			 <div id="divHScroll" style=" overflow:hidden;height:40px;width:920px; margin:0 auto;">
					<table height="40" border=0 align=left cellpadding=0 cellspacing="0">
					  <tr><td id="divHScroll1" valign="bottom">
				  <table width="918" height="40" border=0 cellpadding=0 cellspacing=0>
				  
				 <img  src="../images/mh_pattern.png" alt="Tips" />
				  
				  </table>
				</td><td id=divHScroll2 valign=top></td></tr></table></div>
			
				 <script type="text/javascript">
				     var speed1 = 25//速度数值越大速度越慢
				     document.getElementById("divHScroll2").innerHTML = document.getElementById("divHScroll1").innerHTML
				     function Marquee1() {
				         if (document.getElementById("divHScroll2").offsetWidth - document.getElementById("divHScroll").scrollLeft <= 0)
				             document.getElementById("divHScroll").scrollLeft -= document.getElementById("divHScroll1").offsetWidth
				         else {
				             document.getElementById("divHScroll").scrollLeft++
				         }
				     }
				     var MyMar1 = setInterval(Marquee1, speed1)
				     document.getElementById("divHScroll").onmouseover = function() { clearInterval(MyMar1) }
				     document.getElementById("divHScroll").onmouseout = function() { MyMar1 = setInterval(Marquee1, speed1) }
 				 </script> 

 

你可能感兴趣的:(JavaScript,浏览器)