当前位置:编程学习 > C#/ASP.NET >>

DataList 套一个无缝跑马灯效果

下面是DataList代码:
 <asp:DataList ID="DataList2" runat="server" CellSpacing="1" RepeatColumns="4" Width="544px" Font-Size="Smaller">
<ItemTemplate>
 <a href='information.aspx?product_id=<%#container.DataItem("product_id") %>'>
                                <image border="0" height="100" src='photo/<%#container.DataItem("photo_url") %>'width="100">
</image>
 </a>
</br>
<font color="blue" size="2">名称:</font><%#Container.DataItem("product_information")%> 
<br>
<font color="blue" size="2">剩余:</font><%#Container.DataItem("product_per")%>                  
</ItemTemplate>
</asp:DataList>

我想在外面 套个JS的 无缝跑马等效果  在网上下了JS代码  我套了一上午 硬是没套出来

哪位大哥 帮帮小弟 谢谢了  --------------------编程问答-------------------- http://hi.baidu.com/08hlw/blog/item/b6b8e0a8a37161b5ca130ce9.html --------------------编程问答-------------------- xuexi !! --------------------编程问答--------------------
 <table align="center" border="0" cellpadding="0" cellspacing="0"  width="750">
       
        <tbody>
            <tr>
                <td>
                    <div id="demo" style="overflow: hidden; width: 100%; color: #ffffff">
                        <table align="left" border="0" cellpadding="0" cellspacing="0" >
                            <tbody>
                                <tr>
                                    <td id="demo1" valign="top">
                                        <!--DataList开始-->
                                        <asp:DataList ID="DataList2" runat="server" RepeatColumns="300" RepeatDirection="Horizontal">
                                            <ItemTemplate>
                                                <table border="0" cellpadding="0" cellspacing="0" >
                                                    <tr>
                                                        <td>
                                                            <table bgcolor="#FFFFFF" border="0" cellpadding="0" cellspacing="2" class="o_smoke">
                                                                <tr>
                                                                    <td>
                                                                        <a href='personinfo.aspx?id=<%#Eval("eppid") %>' target='_blank'>
                                                                            <img border="0" height="120" src='employee/baseinfo/uppic/<%#Eval("pic") %>' title='<%#Eval("empname") %>'
                                                                                width="150" /></a></td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="center">
                                                            <a href='personinfo.aspx?id=<%# Eval("eppid") %>' target="_blank">
                                                                <%#Eval("empname") %>
                                                            </a>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </ItemTemplate>
                                        </asp:DataList>
                                        <!--DataList结束-->
                                    </td>
                                    <td id="demo2" valign="top">
                                         </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>

                    <script language="JavaScript" src="Common/Script/scrollpic.js"></script>

                </td>
            </tr>
        </tbody>
    </table>


scrollpic.js代码如下:
var speed3=25//速度数值越大速度越慢
demo2.innerHTML=demo1.innerHTML
function Marquee(){
if(demo2.offsetWidth-demo.scrollLeft<=0)
demo.scrollLeft-=demo1.offsetWidth
else{
demo.scrollLeft++
}
}
var MyMar=setInterval(Marquee,speed3)
demo.onmouseover=function() {clearInterval(MyMar)}
demo.onmouseout=function() {MyMar=setInterval(Marquee,speed3)}


lz试试 --------------------编程问答-------------------- 3楼代码 OK

  我单建个页面  效果OK 

    但是是 套到主页里 就不行了  纳闷了 --------------------编程问答-------------------- 你主页上有什么特殊的东东?
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,