jsp表达式方式:
复制代码 代码如下:
<center>
<table border="1">
<%
for (int i = 1; i <= 9; i++) {
%>
<tr>
<%
for (int j = 1; j <= 9; j++) {
%>
<td>
<%
if (j <= i) {
%> <%=i%>*<%=i%>=<%=i * j%> <%
} else
%>
</td>
<%
}
%>
</tr>
<%
}
%>
</table>
</center>
javascript方式:
复制代码 代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>99乘法表</title>
<script type="text/javascript">
document.write("<center><table border=\"3\">");
for (i = 1; i <= 9; i++) {
document.write("<tr>");
for (j = 1; j <= 9; j++) {
if (j <= i) {
document.write("<td>" + i + "*" + j + "=" + i * j + "</td>")
} else
document.write("<td> </td>");
}
document.write("</tr>");
}
document.write("</table></center>");
</script>
</head>
<body>
</body>
</html>
复制代码 代码如下:
<center>
<table border="1">
<%
for (int i = 1; i <= 9; i++) {
%>
<tr>
<%
for (int j = 1; j <= 9; j++) {
%>
<td>
<%
if (j <= i) {
%> <%=i%>*<%=i%>=<%=i * j%> <%
} else
%>
</td>
<%
}
%>
</tr>
<%
}
%>
</table>
</center>
javascript方式:
复制代码 代码如下:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>99乘法表</title>
<script type="text/javascript">
document.write("<center><table border=\"3\">");
for (i = 1; i <= 9; i++) {
document.write("<tr>");
for (j = 1; j <= 9; j++) {
if (j <= i) {
document.write("<td>" + i + "*" + j + "=" + i * j + "</td>")
} else
document.write("<td> </td>");
}
document.write("</tr>");
}
document.write("</table></center>");
</script>
</head>
<body>
</body>
</html>
标签:
打印,九九乘法表
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com
暂无“jsp/javascript打印九九乘法表代码”评论...