marque 无缝滚动

向上滚动:

http://www.cnblogs.com/sealzrt/archive/2008/12/24/1361421.html

 

 

向左滚动(div控制):

<html>
<head>
<style type="text/css" mce_bogus="1">#scroll-h {  
 background: #FFF;  
 overflow:hidden;  
 border: 1px dashed #CCC;  
 width: 500px;  
}  
#scroll-h img {  
 border: 3px solid #F2F2F2;  
}  
#inscroll-h {  
 float: left;  
 width: 800%;  
}  
#scroll-h1 {  
 float: left;  
}  
#scroll-h2 {  
 float: left;  
}</style> 
</head>
<body>
向左滚动  
<div id="scroll-h"> 
<div id="inscroll-h"> 
<div id="scroll-h1">  <!--可以放图片-->
aaaaaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbbbbb
cccccccccccccccccccccc
dddddddddddddddddddddd
eeeeeeeeeeeeeeeeeeeeee
&nbsp;

</div> 
<div id="scroll-h2"></div> 
</div> 
</div> 
<script type="text/javascript"><!--  
var speed=10; //数字越大速度越慢  
var tab=document.getElementById("scroll-h");  
var tab1=document.getElementById("scroll-h1");  
var tab2=document.getElementById("scroll-h2");  
tab2.innerHTML=tab1.innerHTML;  
function Marquee(){  
if(tab2.offsetWidth-tab.scrollLeft<=0)  
tab.scrollLeft-=tab1.offsetWidth  
else{  
tab.scrollLeft++;  
}  
}  
var MyMar=setInterval(Marquee,speed);  
tab.onmouseover=function() {clearInterval(MyMar)};  
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};  
 --></script> 
 
</body>
</html>

 

http://topic.csdn.net/u/20090708/10/df5aa8dd-6dac-45e6-a618-a09f9304c015.html

你可能感兴趣的:(JavaScript,html,.net,css)