99乘法表的简单写法

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<!--
* @Author: shmily
* @Date: 2016-12-05 15:44:41
* @Last Modified by: shmily
* @Last Modified time: 2016-12-05 15:44:41
-->
</head>
<body style="font-size:20px;color:#f00; text-align:center;">
<script>
//以表格的形式打印
document.write('<table border = "2">');
for(var i=1;i<10;i++){//循环一个数组
//打印表格行标签
document.write('<tr>');
for(var j=1;j<=i;j++){//循环另外一个数组
//两个数相乘
document.write('<td>'+i+'x'+j+'='+(i*j)+'</td>');
}
document.write('</tr>')
}
document.write('</table>')

</script>
</body>

</html>

 

 

效果如下:

 

posted on 2016-12-05 15:48  仰望108  阅读(582)  评论(0编辑  收藏  举报

导航