Response.Write("<script>alert(\'错误:123\')</script>");Response.Write("<script>alert(\'" + Session["RCSystemInnateSoft_Err"].ToString() +  "\')</script>");
问题是我用第一个弹出框时可以用,就是直接赋值可以显示!而第二个语句的弹出框中的Session[RCSystemInnateSoft_Err].ToString()是保存出错时信息,可不能弹出显示!谢谢了!

解决方案 »

  1.   

    问,你现在SESSION是否为空,请确认一下。如果是空就不行了哦
      

  2.   

    Response.Write("<script>alert(\'错误:123\');
    alert(\'" + Session["RCSystemInnateSoft_Err"].ToString() +  "\')</script>");
      

  3.   

    qzb0818(漂来漂去) 兄,你这语句在我的代码中还是不行!
      

  4.   

    也可以如下:
    Response.Write("<script>alert(\'错误:123\')</script>");
    Response.Flush();
    Response.Write("<script>alert(\'" + Session["RCSystemInnateSoft_Err"].ToString() +  "\')</script>");
      

  5.   

    如果还是不行,改为
    Response.Write("<script>alert(\'错误:123\')</script>");
    Response.Flush();
    Response.Write("<script>alert(\'哦ok:123\')</script>");
    如果能弹出,那就是Response.Write("<script>alert(\'" + Session["RCSystemInnateSoft_Err"].ToString() +  "\')</script>");语句不对,用下面的试试
    Response.Write("<script>alert('" + Session["RCSystemInnateSoft_Err"].ToString() +  "')</script>");
      

  6.   

    Page_Loadstring strScript=@"<script>alert('"+Convert.ToString(Session["RCSystemInnateSoft_Err"])+"')</script>";
    Page.RegisterClientScriptBlock("key",strScript);
      

  7.   

    Response.Write("<script>alert('错误:123')</script>");if(!Object.ReferenceEquals(Request.QueryString["cat"],null))
    {
    Response.Write("<script>alert('" + Session["RCSystemInnateSoft_Err"].ToString() +  "')</script>");
    }
      

  8.   

    找到错误了!因为Session值中有单引号,把单引号Replace后就可以了!呵呵~!谢谢大家了!斑竹可以结帖了!
      

  9.   

    最好用闲云野鹤的这种方式.
    string strScript=@"<script>alert('"+Convert.ToString(Session["RCSystemInnateSoft_Err"])+"')</script>";
    Page.RegisterClientScriptBlock("key",strScript);
    另外结贴是自己结呢