protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 100; i++)
{
Page.ClientScript.RegisterClientScriptBlock(GetType(), "myScript", "<script>alert('hello world');</script>");
}
}
警报只执行一次,是可以执行的警报在每次迭代?
The alert only execute once, is that possible to execute the alert everytime in the iteration?
是通过其更改为,注意myScript的+ I,它改变了关键的OM每次迭代:
yes by changing it to, note the "myScript" + i, it changes the key om every iteration:
for (int i = 0; i < 100; i++)
{
Page.ClientScript.RegisterClientScriptBlock(GetType(), "myScript" + i, "<script>alert('hello world');</script>");
}