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>

     

  • 相关阅读:
    【转帖】asp.net mvc与webform区别
    [学习jquery]深入了解jquery(1)jquery对象
    windows ce 4.2/5.0/6.0/windows mobile设备直接连接PC端的SQLserver
    dotNet dispose 和 close的区别
    简易快速理解 ERP
    互联网盈利模式77种创新 [转]
    软件开发的基础知识[1]
    什么是 SHTML
    ASP.NET 2.0:弃用 DataGrid 吧,有新的网格控件了![msdn]
    主页制作五十式[好帖就要转]
  • 原文地址:https://www.cnblogs.com/ai394495243/p/3334475.html
Copyright © 2011-2022 走看看