摘要:使用Page.ClientScript.RegisterStartupScript() 註冊腳本
原出出處:http://www.cnblogs.com/zhuawang/archive/2007/09/04/881107.html
當有一個頁面需要動態加載 JavaScript 函數時
使用Page.RegisterStartupScript的方法會出現已經過時的訊息
所以,使用Page.ClientScript.RegisterStartupScript()來註冊我們的腳本 
Page.ClientScript.RegisterStartupScript(this.GetType(), "MyScript", "function AlertHello() { alert('你好,ASP.NET'); }", true);
Button1.Attributes["onclick"] = "AlertHello()";
Button2.Attributes["onclick"] = "AlertHello()";