<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
table{
border-collapse: collapse;
width: 800px;
}
td{
border: 1px solid forestgreen;
height: 30px;
line-height: 30px;
text-align: center;
}
</style>
</head>
<body>
<script>
var table="<table>";
for(var i=1;i<=9;i++){
table+="<tr>"
for(var j=1;j<=i;j++){
table+="<td>"+i+"*"+j+"="+i*j+"</td>";
}
table+="</tr>"
}
table+="</table>";
document.write(table);
</script>
</body>
</html>
js 利用for循环实现九九乘法表
最新推荐文章于 2024-03-14 09:23:38 发布