本文介绍了如何调用JavaScript在背后环code?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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>");
}
这篇关于如何调用JavaScript在背后环code?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!