<div id="demos" style="overflow: hidden;width: 100%;">
<div id="indemos" style="float: left;width: 800%; ">
<div id="demos1" style="float: left">
<asp:Repeater ID="rpt_lylist" runat="server">
<ItemTemplate>
<a href="javascript:void(0)" target="_blank" title='<%#Eval("title") %>'>
[<%#Eval("title").ToString().Length > 16 ? Eval("title").ToString().Substring(0, 16) + ".." : Eval("title") %>]
</a>
</ItemTemplate>
</asp:Repeater>
</div>
<div id="demos2" style="float: left;"></div>
</div>
</div>
<script type="text/javascript">
var speed=30;
var tabs=document.getElementById("demos");
var tabs1=document.getElementById("demos1");
var tabs2=document.getElementById("demos2");
tabs2.innerHTML=tabs1.innerHTML;
function Marquee(){
if(tabs2.offsetWidth-tabs.scrollLeft<=0)
tabs.scrollLeft-=tabs1.offsetWidth;
else{
tabs.scrollLeft++;
}
};
var MyMar=setInterval(Marquee,speed);
tabs.onmouseover=function() {
clearInterval(MyMar);
}
tabs.onmouseout=function() {MyMar=setInterval(Marquee,speed);}
</script>
悬浮上去,不停止滚动,把 tabs.onmouseover=function() { clearInterval(MyMar); } 这段话里面的 clearInterval(MyMar);注释掉即可, 修改为: tabs.onmouseover=function() {
//clearInterval(MyMar);
}
注释掉了,鼠标悬浮上去还是滚的死去活来的……
我单独建立一个页面做试验,他就可以停下来了,其他的JS影响了……