日期:2014-05-17  浏览次数:20418 次

Google浏览器不兼容JS+Repeater的无缝滚动
JS代码:
                var speed=40;
                var demo2=document.getElementById("demo2");
                var demo1=document.getElementById("demo1");
                var demo=document.getElementById("demo");
                demo2.innerHTML=demo1.innerHTML
                function Marquee(){
                if(demo2.offsetTop-demo.scrollTop<=0)
                demo.scrollTop-=demo1.offsetHeight;
                else{
                demo.scrollTop++;
                }
                }
                var MyMar=setInterval(Marquee,speed);
                demo.onmouseover=function() {clearInterval(MyMar)}
                demo.onmouseout=function() {MyMar=setInterval(Marquee,speed)}


前台代码:
   <div id="demo" style="overflow: hidden; height:250px; margin-top:50px;">
                <div id="demo1">
                    <div class="newslist_right">
                        <asp:Repeater ID="rtNews" runat="server">
                            <ItemTemplate>
                                <a href='News.aspx?id=<%#Eval("AutoId") %>'><strong>
                                    <%#Eval("CreateTime","{0:dd/MM/yyyy}") %></strong>
                                    <%#Eval("NewsTitle").ToString().Length > 15 ? Eval("NewsTitle").ToString().Substring(0, 13) + ".." : Eval("NewsTitle")%>
      &nbs