GridView内的数据循环滚动

<div id="head1"></div>
 <div id="PriceView" style="height:186px;width:100%;overflow-y: hidden;">
<div id="PriceView1">
<asp:GridView ID="grwPriceList" runat="server"  AllowSorting="True" AutoGenerateColumns="False"
    CellPadding="4" ForeColor="#333333" Width="100%"> 
    <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
    <Columns>
        <asp:BoundField DataField="ProductId" Visible="False" />
        <asp:BoundField DataField="ProductName" HeaderText="品名" />
         <asp:BoundField DataField="Spec" HeaderText="规格"/>
        <asp:BoundField DataField="MaxPrice" HeaderText="最高价"/>
        <asp:BoundField DataField="MinPrice" HeaderText="最低价"/>
        <asp:BoundField DataField="AvgPrice" HeaderText="均价"/>
         <asp:BoundField DataField="PriceDate" HeaderText="时间"/>
        
        
        <asp:TemplateField HeaderText="趋势">
            <ItemTemplate>
<a href="javascript:void(window.open('ShowChart.aspx?ProductID= <%# Eval( "ProductID" )%>','', 'toolbar=no,menubar=no, scrollbars=no, resizable=no,location=no, status=no,height=450,width=840'));" target="_top" > <img alt="" style="border:0;" src="img/chart.png"  />               
               </a> 

            </ItemTemplate>
        </asp:TemplateField>
        
        
    </Columns>
                <RowStyle BorderColor="#EEEEEE" BorderStyle="Dotted" BorderWidth="1px"    />
                   <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White"  />
</asp:GridView>
    </div>

<div id="PriceView2"></div>
</div>
 <script>
      function scrool() {
          var t = document.getElementById("<%=grwPriceList.ClientID%>");
          var t2 = t.cloneNode(true)
          for (i = t2.rows.length - 1; i > 0; i--)
              t2.deleteRow(i)
          t.deleteRow(0)
          head1.appendChild(t2)
          ss();
      }
      window.onload = scrool
</script>
<script>
    function ss() {
        var speed0 = 40
        var PriceView = document.getElementById("PriceView");
        var PriceView2 = document.getElementById("PriceView2");

        var PriceView1 = document.getElementById("PriceView1");

        PriceView2.innerHTML = PriceView1.innerHTML
        function Marquee0() {
            if (PriceView2.offsetTop - PriceView.scrollTop <= 20)
                PriceView.scrollTop -= PriceView1.offsetHeight
            else {
                PriceView.scrollTop++
            }
        }
        var MyMar0 = setInterval(Marquee0, speed0)
        PriceView.onmouseover = function () { clearInterval(MyMar0) }
        PriceView.onmouseout = function () { MyMar0 = setInterval(Marquee0, speed0) }
    }
</script>

你可能感兴趣的:(GridView)