for (int i = 0; i < N; i++)
{
string str;
str = textBox1.Text.Substring (N-1) + textBox1.Text.Substring(0, N - 1);
textBox1.Text = str;
System.Threading.Thread.Sleep(1000);
}用for循环实现字体滚动为什么不行
{
string str;
str = textBox1.Text.Substring (N-1) + textBox1.Text.Substring(0, N - 1);
textBox1.Text = str;
System.Threading.Thread.Sleep(1000);
}用for循环实现字体滚动为什么不行
{
string str;
str = textBox1.Text.Substring (N-1) + textBox1.Text.Substring(0, N - 1);
textBox1.Text = str;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
}
{
string str;
str = textBox1.Text.Substring (i-1) + textBox1.Text.Substring(0, i - 1);
textBox1.Text = str;
Application.DoEvents();
System.Threading.Thread.Sleep(1000);
}
前台:<body style="margin: 0px" <%=stringGongGao%>>
<form id="form1" runat="server">
<table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="td">
<div class="d1" id="div1" onmouseover="clearInterval(timer)" onmouseout="timer=setInterval(mar,30)">
<div id="scroll">
<div class="div2" id="div2">
<a href="#" target="_self" id="detail_link"><span id="detail"></span></a>
</div>
<div id="div3" class="div2"></div>
</div>
</div>
</td>
</table>
</form>
</body>后台:
protected string stringGongGao;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Button2.Attributes.Add("target", "mainframe");
Models.login_user userName = new bllUser().GetUserInfo(Session["uid"].ToString());
Label1.Text = userName.user_name;
lb_riqi.Text = DateTime.Now.ToString("yyyy年MM月dd日") + xq();
//lb_xingqi.Text =DateTime.Now.ToString("T"); stringGongGao = GetStr();
}
} private string GetStr()
{
string strS = string.Empty;
string strSql = @"select ......";
DataSet ds = GetTable(strSql);
string str = ds.Tables[0].Rows[0][0].ToString();
strS = "onload=init('" + str + "')";
return strS;
}js:
var s, s2, s3, s4, timer;
function init(details) {
fillFont(details);
s = getid("div1");
s2 = getid("div2");
s3 = getid("div3");
s4 = getid("scroll");
s4.style.width = (s2.offsetWidth * 6 + 100) + "px";
s3.innerHTML = s2.innerHTML;
timer = setInterval(mar, 30)
}
function mar() {
if (s2.offsetWidth <= s.scrollLeft) {
s.scrollLeft -= s2.offsetWidth;
} else { s.scrollLeft++; }
}
function getid(id) {
return document.getElementById(id);
}
function fillFont(details) {
detail.innerHTML = details;
}
Models.login_user userName = new bllUser().GetUserInfo(Session["uid"].ToString());
Label1.Text = userName.user_name;
lb_riqi.Text = DateTime.Now.ToString("yyyy年MM月dd日") + xq();
没有用!