Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
什么在阻止Javascript执行?_Javascript_C#_Asp.net - Fatal编程技术网

什么在阻止Javascript执行?

什么在阻止Javascript执行?,javascript,c#,asp.net,Javascript,C#,Asp.net,虽然我在page_load事件中调用了另一个Javascript,但这两个Javascript函数都没有在“btnrepeat()”中执行,而且工作正常 C# 函数正在做它应该做的事情,所以没有逻辑错误 我也试过 RegisterStartupScript(GetType(),“mytts”,“abcd(),true) 最后3行注释是另一个问题,它不起作用…为什么?它不起作用,因为当btnrepeat完成时,已完成的html页面已发送到客户端,因为您是在另一个线程中启动的。这也是Label1未更

虽然我在page_load事件中调用了另一个Javascript,但这两个Javascript函数都没有在“btnrepeat()”中执行,而且工作正常

C#

函数正在做它应该做的事情,所以没有逻辑错误

我也试过

RegisterStartupScript(GetType(),“mytts”,“abcd(),true)


最后3行注释是另一个问题,它不起作用…为什么?

它不起作用,因为当
btnrepeat
完成时,已完成的html页面已发送到客户端,因为您是在另一个线程中启动的。这也是
Label1
未更新的原因。IIS中的线程工作方式与“普通”windows程序中的不同。@VDWWD解决方案是什么?
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
}
function abcd() {
    alert('hello');
}