• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

c#.net 动态读取 走马灯代码实例分享

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

前台html及js脚本:

[html]

复制代码 代码如下:

<div>
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="#CC66FF" 
                style="WIDTH: 990px; HEIGHT: 5px; BACKGROUND-COLOR: #ffffff; text-align: center;">
            </td>
        </tr>
        <tr>
            <td style="BORDER-RIGHT: #cccc99 1px solid; BORDER-TOP: #cccc99 1px solid; BORDER-LEFT: #cccc99 1px solid; WIDTH: 990px; BORDER-BOTTOM: #cccc99 1px solid">
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td style="WIDTH: 990px; BACKGROUND-COLOR: #ffffff">
                            <div style="WIDTH: 990px; HEIGHT: 139px">
                                <div id="demo" 
                                    style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: hidden; WIDTH: 100%; COLOR: #ffffff; PADDING-TOP: 0px">
                                    <table align="left" border="0" cellpadding="0" cellspace="0" cellspacing="0" 
                                        style="WIDTH: 900px; HEIGHT: 139px">
                                        <tr>
                                            <td id="demo1" valign="top">
                                                <table border="0" cellpadding="0" cellspacing="0" width="2000">
                                                    <tr> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
                                                        </tr>

                                                </table>
                                            </td>
                                            <td id="demo2" valign="top">
                                            </td>
                                        </tr>
                                    </table>
                                </div>
<SCRIPT __designer:dtid="3377854339350821">
var speed3=1//速度数值越大速度越慢
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)}
</SCRIPT>
                                </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="WIDTH: 100px; HEIGHT: 5px">
            </td>
        </tr>
    </table>
</div>

 

 cs页的代码:

[csharp]

复制代码 代码如下:

dal_Collection dc = new dal_Collection();
Label1.Text = dc.GetIndexZouMaDeng();
 

dal_Collection.GetIndexZouMaDeng()的代码:


[csharp]
复制代码 代码如下:

using System.Text;

[csharp]

复制代码 代码如下:

public string GetIndexZouMaDeng()
    {

        StringBuilder res = new StringBuilder();
        DataTable dt0 = GetNewsPageDB("select top 10  CN_Id, CN_Title,CN_Intro,CN_Url,CN_Uid,CN_Times from Collection order by CN_Times desc");
        if (dt0.Rows.Count == 0)
        {
            res.Append("暂无相关数据!");
        }
        else
        {
            for (int i = 0; i < dt0.Rows.Count; i++)//参见【注释1】
            {
                res.Append("<td align=\"center\" height=\"139\" width=\"184\"><img height=\"135\" src=\"" + dt0.Rows[i][3].ToString().Substring(2) + "\" width=\"180\" /></td>");

            }
            if (dt0.Rows.Count <= 6)
            {
                res.Append(res.ToString());
            }
        }

        return res.ToString();
    }


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
asp.net中js和jquery调用ashx的不同方法分享发布时间:2022-02-05
下一篇:
Asp.net 2.0 无刷新图片上传 显示缩略图 具体实现发布时间:2022-02-05
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap