温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

c#.net怎么动态读取走马灯代码

发布时间:2021-07-23 09:16:36 来源:亿速云 阅读:184 作者:chen 栏目:开发技术

本篇内容介绍了“c#.net怎么动态读取走马灯代码”的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!

前台html及js脚本:

[html]

复制代码 代码如下:


<div>
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td bgcolor="#CC66FF" 
                >
            </td>
        </tr>
        <tr>
            <td >
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td >
                            <div >
                                <div id="demo" 
                                    >
                                    <table align="left" border="0" cellpadding="0" cellspace="0" cellspacing="0" 
                                        >
                                        <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 >
            </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();
    }

“c#.net怎么动态读取走马灯代码”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注亿速云网站,小编将为大家输出更多高质量的实用文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI