-2
我想调用JavaScript函数,以防在我的代码背后发生某些情况。运行按钮按下按钮ASP.NET ASP.NET
如果它像下面的代码,它可以正常工作后回发警报窗口显示并说。但是,如果我从else块删除注释,那么else块中的这两个脚本都不会发生?
我可以从代码隐藏中做出多少这些操作,是否有任何限制?
if (condition) {
if (condition2) {
var message = "It happened !";
Page.ClientScript.RegisterStartupScript(this.GetType(), "yep1", "alert('" + message + "')", true);
}
} else {
var msg = "It does not work like that";
Page.ClientScript.RegisterStartupScript(this.GetType(), "nope1", "alert('" + msg + "!')", true);
//Page.ClientScript.RegisterStartupScript(this.GetType(), "nope2", "alert('" + msg + "')", true);
}
所以启动脚本的数量可以注册为1,并且如何调用多个函数的方式是将它们链接成一个字符串? 只是一个音符味精没有声明在第二个如果陈述。 //是有效的。非常感谢你。 – Bendom