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>

     

  • 相关阅读:
    strcpy,memset,memcpy三者之间的根本区别
    最便捷、最强大、速度最快的C++序列化框架
    C++读写二进制文件
    boost binary 序列化
    febird.dataio和boost.serialization性能对比
    Boost文本序列化和二进制序列化的效率比较
    Boost文本序列化和二进制序列化的效率比较
    c++的vector赋值方法汇总
    OCP-1Z0-051-V9.02-36题
    遍历list或map时删除元素(较巧妙)
  • 原文地址:https://www.cnblogs.com/ai394495243/p/3334475.html
Copyright © 2011-2022 走看看