aspx页面中写if else 语句的方法,

  第一种方法: 在页面中引用<% %>此符号书写后台if else 语句

 <%
        string s = "1";
        if (s == "1")
        {
            Response.Write("<script> alert ('成功')</script>");

        }
        else
        {
            Response.Write("<script> alert ('失败')</script>");
        }
         %>
    第二种方法:需要在后台声明一个全局变量isok
    <%if (isok == "")
      {%>
          Response.Write("失败");
          <%} %>                                            
    <%else
        {%>
      Response.Write("失败");
      <%}%>

posted @ 2012-12-25 15:26  天殇月痕  阅读(545)  评论(0)    收藏  举报