zoukankan      html  css  js  c++  java
  • 用Response对象的write方法和<%%>及<%=%>输出同样效果的乘法表格

     

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Response1.aspx.cs" Inherits="WebApplication1.Response1" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title><%--用<%%>及<%=%>输出乘法表--%></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
          <table border="1" width="600px">
          <tr><th colspan="9">九九乘法表</th></tr>
          <%
              for (int i = 1; i < 10; i++)
              {
                  %>
             <tr>
             <% 
              for (int j = 1; j < 10; j++)//输出一行的每列
              {
                  if (j <= i)
                  {//如果没内容
             %>
             <td><%=j%>*<%=i%>=<%=i * j%></td>
             <% }
                  else
                  {//否则输出空单元格
                 %>
                 <td>&nbsp;</td>
                 <% }
              } %>
                   </tr>
                   <%
              }
                %>
          </table>
        </div>
        </form>
    </body>
    </html>

     

    -------------------------------------------------------------用<%%>和<%=%>输出的--------------------------------------------------------------------------

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Response.aspx.cs" Inherits="WebApplication1.Response" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title>用Response对象的Write方法<% %></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
          <table border="1" width="600px">
          <tr><th colspan="9">九九乘法表</th></tr>
          <%
              for (int i = 1; i < 10; i++)
              {
                  Response.Write("<tr>");
                  for (int j = 1; j < 10; j++)//输出一行中的每列
                  {
                      if (j <= i)
                      {//如果没有内容
                          Response.Write(string.Format("<td>{0}*{1}={2}</td>", j, i, j * i));
                      }
                      else
                      {//否则输出空格
                          Response.Write("<td>&nbsp;</td>");
                      }
                  }
                  Response.Write("</tr>");
              }
               %>
          </table>
        
        </div>
        </form>
    </body>
    </html>

     

  • 相关阅读:
    BZOJ1218:[HNOI2003]激光炸弹
    洛谷【P3407】散步
    洛谷【P1142】轰炸
    洛谷【P1358】扑克牌
    洛谷【P1236】算24点
    洛谷【P2003】平板
    TVYJ1266:费解的开关
    POJ1958:Strange Towers of Hanoi
    孤独地、凄惨地AK
    ios---scrollview用法总结
  • 原文地址:https://www.cnblogs.com/ai394495243/p/3334475.html
Copyright © 2011-2022 走看看