<script type="text/javascript" >
function step(){
for(i=1i<=9i++){
for(j=1j<=ij++){
document.write(i+"x"+j+"="+i*j +" ")
}document.write("<br/>")
}
}
</script>
</head>
<body onload="step()">
</body>
扩展资料
c语言九九乘法表,具体代码如下,在Trubo2.0、3.0、VC6.0下正常。
#include <stdio.h>
int main(void)
{
int i,j
for (i=1i<=9i++)
{
for (j=1j<=ij++)
printf("%d*%d=%d ",j,i,j*i)
printf("\n")
}
}
首先基础是一个表格;
例//row=5 col=5
var str = "<table>"
var row = 1
while (row < 6) {
str += "<tr>"
var col = 1
while (col < 6) {
str += "<td>" + row + "</td>"
col++
}
str += "</tr>"
row++
}
str += "</table>"
document.body.innerHTML += str
<!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>
td {
width: 20px
height: 10px
border: 1px solid #000
}
</style>
</head>
<body>
<script>
//乘法表
var str = "<table>"
var row = 1
while (row < 10) {
str += "<tr>"
var col = 1
//让后面的值小于等于前面得值
while (col <= row) {
str += "<td>" + row + "*" + col + "=" + row * col + "</td>"
col++
}
str += "</tr>"
row++
}
str += "</table>"
document.body.innerHTML += str
</script>
</body>
</html>