-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