Response.Write ("<Script>alert('"+errormsg+"')</script>");

解决方案 »

  1.   

    或者在页面中写
    <script>
    alert('<%=errormsg%>');
    </script>
    不过这样要求errormsg是在aspx文件申请,或者在后置代码中申请为类成员,而且不是private类型的
      

  2.   

    Response.Write("<script>alert(\""+errormsg.Replcae("\"","\\\"")+"\");</script>");
      

  3.   

    class MyMessage{
      static show(string errormsg){
          HttpContext.Current.Response.Write("<script>");
          HttpContext.Current.Response.Write("alert(\""+errormsg+"\")");
          HttpContext.Current.Response.Write("</script>");
      }
    }
      

  4.   

    这样使用:MyMessage.show(errormsg);
      

  5.   

    http://expert.csdn.net/Expert/topic/1213/1213430.xml?temp=.3665125
    请使用搜索,试试,类似的问题已有解答!