JS实现九九乘法表

效果图:

 

 

代码:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>九九乘法表</title>
    <style type="text/css">
      td{
        border: 1px solid black;
        box-sizing: border-box;
      }
    </style>
</head>
<body>

<script type="application/javascript">
  document.write("<table cellspacing='10'>")
  for(var i=1;i<=9;i++){
    document.write("<tr>")
    for(var j=1;j<=i;j++){
        document.write('<td>'+j+'x'+i+'='+i*j+"</td>");
    }
    document.write("</tr>")
  }
  document.write("</table>")
</script>
</body>
</html>

 

.

posted @ 2019-04-02 09:21  剑仙6  阅读(1749)  评论(0编辑  收藏  举报
欢迎访问个人网站www.qingchun.在线