This problem before also troubled me, later solved, take out to share under, later use also convenient, code is easy to understand, not much to say what
[HTML]View Plaincopyprint?
- <div id="Demo" style="Overflow:hidden; width:441px; border:0px ">
- <table width="441" height=" border=" 0 " cellpadding=" 0 " cellspacing="0" background="images/img2/32.jpg">
- <tr>
- <td align= "center" id= "Demo1" valign= "bottom" >
- <asp:datalist id="DataList1" runat="Server" repeatdirection="Horizontal " datasourceid="ObjectDataSource1">
- <ItemTemplate>
- <table>
- <tr>
- <TD>
- <asp:imagebutton id= "Imgbtninfo" runat= "server" imageurl= <%# Eval ("spic") %> ' onclick= ' Imgbtninfo_click '
- commandargument=' <% #Eval ("ID")%> ' />
- </td>
- </tr>
- <tr>
- <td align= "center" >
- <asp:linkbutton id= "Lkbtninfo" Commandargument= <% #Eval ("ID") %> ' runat = "server" &NBSP;&NBSP;
- OnClick=" Lkbtninfo_click " cssclass=" BB " text= ' <% #Eval ("Type") %> ' ></asp:linkbutton>
- </td>
- </tr>
- </Table>
- </ItemTemplate>
- </asp:datalist>
- <asp:objectdatasource id="ObjectDataSource1" runat= "server" selectmethod=" Selectinfo "
- typename="hoteldal.kefangservices"></asp:objectdatasource>
- </td>
- <%--This step is important--%>
- <TD Id="Demo2" align= "Center" valign="Bottom">
- </td>
- </tr>
- </Table>
- </div>
- <script>
- Scrolling speed, the higher the value, the slower the speed
- var speed =
- demo2.innerhtml = demo1.innerhtml
- From right to left
- function Marquee () {
- if (Demo1.offsetwidth-demo.scrollleft <= 0)
- Demo.scrollleft = 0
- Else
- demo.scrollleft++
- }
- var mymar = setinterval (Marquee, speed)
- Demo.onmouseover = function () {clearinterval (MyMar)}
- Demo.onmouseout = function () { MyMar = setinterval (Marquee, Speed)}
- </Script>
Asp. NET for seamless scrolling of pictures with DataList