jsp编写网页输出乘法口诀表怎么做
发布网友
发布时间:2023-04-26 04:09
我来回答
共3个回答
热心网友
时间:2023-11-09 04:48
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JSP九九乘法表</title>
</head>
<body>
<h1>九九乘法表</h1>
<table border="0">
<%
for(int i = 1; i <=9; i++){ //行
%>
<tr>
<%
for(int j = 1; j <=i; j++){ //列
%>
<td style="border:2px solid black;padding:2px">
<%=j%>✕<%=i%>=<%=i*j%>
</td>
<%
}
%>
</tr>
<%
}
%>
</table>
</body>
</html>
热心网友
时间:2023-11-09 04:48
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<head>
<script type="text/javascript">
window.onload=function()
{
initHtml();
tbl99();
}
function tbl99()
{
var tblStr = "<table>";
for(var i=1; i<10; i++)
{
tblStr += "<tr>";
for(var j=1; j<i+1; j++)
{
tblStr += "<td>"+j+"*"+i+"="+i*j+"</td>";
}
tblStr += "</tr>";
}
tblStr += "</table>";
document.getElementById("tbl_cf").innerHTML=tblStr;
}
function initHtml()
{
document.body.innerHTML="<div id='tbl_cf'></div>";
}
</script>
<style type="text/css">
td, div
{
/*background-color:#DFD;
cursor: move;*/
cursor: default;
}
table tr td
{
border:solid 1px blue;
}
.tbl_focus_tr
{
background:#F0F0FF;
}
.tbl_click_tr
{
background:#DDF;
}
</style>
</head>
<body>
</body>
</html>
热心网友
时间:2023-11-09 04:49
<html >
<head>
</head>
<body>
<script language="javascript">
for (j=1;j<=9;j++){
for (i=1;i<=j;i++){
document.write(i+"*"+j+"="+i*j+" ")
if (i==2 && j<=4){
document.write(" ")}}
document.write("<br>")
}
</script>
</body>
</html>
文件名直接写?.jsp,放到服务器上,然后访问就可以了。