JSP实例:大九九乘法表

这里写图片描述

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>19*19</title>
</head>
<body>
    <h1 align="center">19 * 19</h1>
    <table border="1" width="80%">
        <%
            for (int i = 0; i <= 20; i++) {
        %>
        <tr>
            <%
                for (int j = 0; j < 20; j++) {
                    if (i == 0 && j == 0) {
            %>
            <td><%="x"%></td>
            <%
                } else if (i == 0) {
            %>
            <td><%=j%></td>
            <%
                } else if (j == 0) {
            %>
            <td><%=i%></td>
            <%
                } else {
            %>
            <td><%=i + "x" + j + "=" + i * j%></td>
            <%
                }
                }
            %>
        </tr>
        <%
            }
        %>
    </table>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/qq_26416195/article/details/81233657
今日推荐