为什么在IE8下面我的Response.Write("<script>alert('删除成功!')</script>");
没有用,老是弹不出来提示~~怎么回事?

解决方案 »

  1.   

    是你其他的代码导致的,一个页面就这一行不能弹出?
    另外,不要在ajax里这样写,
    另外,还可以使用
    ClientScriptManager.RegisterStartupScript 方法 http://msdn.microsoft.com/zh-cn/library/system.web.ui.clientscriptmanager.registerstartupscript%28VS.90%29.aspx
      

  2.   

    真的吗?ie8更“科学”了吗?如果你看看客户端html源代码,你还认为它是一个完整的html吗?使用  RegisterClientScriptBlock 或者 RegisterStartupScript。如果你觉得那个代码有点多,可以写为一个通用的方法。
      

  3.   

    最好不要用response.write 换个其他方式吧
      

  4.   

    直接写在html里试一下,看是什么效果?
      

  5.   

    代码如下:
    protected void updatenow_Click(object sender, EventArgs e)
            {
                if (CTag.Text.Trim()!=T_str.Trim())
                {
                    T_str = strTag();
                }
                sqlcon.Open();
                string sqlstr = "upd_Content " + cid.Trim() + ",'" + CTitle.Text.Trim() + "','" + Ipp.Text.Trim() + "','" + CKey.Text.Trim() + "','" + Cdisc.Text.Trim() + "','" + webFilePath + "','" + DateTime.Now.ToString() + "'," + AI.ToString() + "," + BI.ToString() + "," + B_str + "," + A_str + "," + T_str;
                try
                {
                    SqlCommand com = new SqlCommand(sqlstr,sqlcon);
                    com.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    sqlcon.Close();
                    Response.Write("<script> alert('成功修改文章!') </script>");
                    Response.Redirect("ConList.aspx");
                }
            }
      

  6.   

    把Response.Redirect("ConList.aspx");
    改成Server.Transfer("ConList.aspx");
      

  7.   


    你难道不知道Response.Redirect是干啥的吗?
      

  8.   

    我当时也是试了好久才试出来的,关于Response.Redirect()与Server.Transfer()的区别我也说不清楚,建议到网上查下
      

  9.   


    Response.Redirect我知道,只是不知道
    Response.Redirect("ConList.aspx")和Server.Transfer("ConList.aspx")有什么区别~~~