在" btnrepeat()"中都没有执行Javascript函数,虽然我在page_load事件中调用了另一个javascript并且工作正常
C#
protected void Button1_Click(object sender, EventArgs e)
{
Timer1.Enabled = true;
workerThread = new Thread(new ThreadStart(btnrepeat));
workerThread.Start();
}
protected void btnrepeat()
{
ClientScript.RegisterClientScriptBlock(GetType(), "mys", "abcd()", true);
for (int i = 1; i <= filecount; i++)
{
string trnsfrpth = @"E:\\ProjectLocalPath\" + filename;
last_file++;
balance_load(filename, trnsfrpth);
Thread.Sleep(200);
}
ClientScript.RegisterClientScriptBlock(GetType(), "mytts", "abcd()", true);
//Label1.InnerHtml = last_file.ToString();
//This is not aspx label, but an HTML div
//this is possible actually but not working here
}
的Javascript
function abcd() {
alert('hello');
}
功能正在做它应该做的事情,所以没有逻辑错误。
我也试过了,
ClientScript.RegisterStartupScript(GetType(),&#34; mytts&#34;,&#34; abcd()&#34;,true);
最后3行评论是另一个问题,它不起作用......为什么?