不要使用Response.Write()这种方式输出脚本
而是
Page.ClientScript.RegisterStartupScript(this.GetType(), "", " <script type='text/JavaScript'>alert('xxx') </script>");
而是
Page.ClientScript.RegisterStartupScript(this.GetType(), "", " <script type='text/JavaScript'>alert('xxx') </script>");