<%@page contentType="text/html; charset=GBK"%>
<html>
<head>
<title>乘法表</title>
</head>
<body bgcolor="#ffffff">
<h1 align="center">${param.in} 和
${param.in} 的乘法表
</h1>
<table align="center" border="1">
<form method="post" action="chenfai.jsp" >
<tr bgcolor="#ff0000">
<font color="#00ff00" size="2"> 请输入乘数:<input type="text" name="in" >
<input type="submit" value="提交" ></font>
</tr>
</form>
<%
int k = 0;
if(request.getParameter("in")==null)
{
k=0;
}
else
{
k = Integer.parseInt(request.getParameter("in"));
}
for (int i = 0; i <= k; i++) {
out.println("<tr>");
for (int j = 0; j <= k; j++) {
if(i==0 && j==0)
{
out.println("<td bgcolor='#00ffff'><font size='2' color='#ff0000'>×</td>");
}else if(j==0)
{
out.println("<td bgcolor='#00ffff'>"+i+"</td>");
}
else if(i==0)
{
out.println("<td bgcolor='#00ffff'>"+j+"</td>");
}else
{
out.println("<td>"+i*j+"</td>");
}
}
out.println("</tr>");
}
%>
</table>
</body>
</html>