Use DataList in ASP. NET to implement seamless image scrolling instance sharing

Source: Internet
Author: User

[Html]
Copy codeThe Code is as follows:
<Div id = "demo" style = "overflow: hidden; width: 441px; border: 0px">
<Table width = "441" height = "130" 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"
OnClick = "lkbtnInfo_Click" CssClass = "bb" Text = '<% # Eval ("Type") %>'> </asp: LinkButton>
</Td>
</Tr>
</Table>
</ItemTemplate>
</Asp: DataList>
<Asp: ObjectDataSource ID = "objectperformance1" runat = "server" SelectMethod = "SelectInfo"
TypeName = "mongodal. KeFangServices"> </asp: ObjectDataSource>
</Td>
<% -- This step is important -- %>
<Td id = "demo2" align = "center" valign = "bottom">
</Td>
</Tr>
</Table>
</Div>
<Script>
// Scroll speed. The greater the value, the slower the speed.
Var speed = 20
Demo2.innerHTML = demo1.innerHTML
// From right to left
Function Marquee (){
If (demo1.offsetWidth-demo. scrollLeft <= 0)
Demo. scrollLeft = 0
Else
Demo. scrollLeft ++
} Www.jb51.net
Var MyMar = setInterval (Marquee, speed)
Demo. onmouseover = function () {clearInterval (MyMar )}
Demo. onmouseout = function () {MyMar = setInterval (Marquee, speed )}
</Script>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.