不要用 Response.Write。

 string js = <script>window.open('Commodity_open.aspx?id=" + id + "','','width=450,height=450') </script>";
 Page.RegisterStartupScript("", js);
还有其他的

解决方案 »

  1.   

    别用Response.Write,用page.clientscript.registerstartupscript输出js
      

  2.   

    ASP.NET 2.0里默认使用<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">文档定义模型,这个dtd的规则与以前的不同,因此,许多以前写的代码在新标准下无法正常运行。
    Response.Write 表示在当然输-出流位置写入数据ASP.NET 中不要随便使用 Response.Write,会打乱 ASP.NET 的输出流顺序在 .aspx.cs 中使用 Response.Write 的输出会出现在页面的最顶部会导致页面布局得不到预期效果    他会打乱你的面向对象模型可以用 Page.ClientScript.RegisterStartupScript(this.GetType(),"alert","<script>alert('保存成功');</script>"); 来代替
    或者你也可以用   
        在页面中加一个<asp:Literal ID="Literal1" runat="server"></asp:Literal>控件,把代码赋给它  这个办法去解决。。
      

  3.   

      不过你也可以加上一句Response.Write(<script>"js代码"; window.location=window.location;</script>);这样试试不知道可不可以。
      

  4.   

    严禁使用Response.Write(" <script>要用
    ClientScript.RegisterClientScriptBlock(this.GetType(), "",
                "<script>alert('" + msg + "');location='" + redirect + "';</script>");
      

  5.   

    嗯,用1楼的方法就可以解决了,因为Response.Write是将js添加到了文本最前端,会影响样式的