Page.ClientScript.RegisterClientScriptBlock没有反应
protected void Page_Load(object sender, EventArgs e)
{
string myScript = @ "function AlertHello(){alert( 'Hello ASP.NET ');} ";
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript ", myScript, true);
}
执行这段代码,没有任何反应,看看那里有问题?怎么才能弹出对话框?
[解决办法]
string myScript = @ "window.onload = function AlertHello(){alert( 'Hello ASP.NET ');} ";
-->
string myScript = @ " <script> window.onload = function AlertHello(){alert( 'Hello ASP.NET ');} </script> ";