<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <!-- CSS样式 -->
    <style>
        * {
            padding: 0;
            margin: 0;
        }
        table {
            width: 800px;
            height: 350px;
            margin: 100px auto;
            text-align: center;
            border-collapse: collapse;
        }
        table,
        td {
            border: 1px solid #000;
        }
    </style>
</head>
<body>
</body>
<script>
    // 原始版
    // document.write("<table>");
    // var j = 1;
    // while (j <= 9) {
    //     document.write("<tr>");
    //     var i = 1;
    //     while (i <= j) {
    //         document.write("<td>" + i + "*" + j + "=" + (i*j) + "</td>");
    //         i++;
    //     }
    //     document.write("</tr>");
    //     j++;
    // }
    // document.write("</table>");
 

 //- - -分割线- - - -

    // 附带奇偶数换色版
    document.write("<table>");
    for (var h = 1; h <= 9; h++) {  //循环行数
        // 奇偶数行换色
        if (h % 2 == 1) {
            document.write("<tr style='background:pink;'>");
        } else {
            document.write("<tr style='background:#6ff;'>");
        }
        for (var g = 1; g <= h; g++) {  //循环列数,且列要小于等于行数
            // 隔列变色
            if (g % 2 == 1) {
                document.write("<td style='background:pink;'>" + g + "*" + h + "=" + g * h + "</td>");
            } else {
                document.write("<td style='background:#6ff;'>" + g + "*" + h + "=" + g * h + "</td>");
            }
        }
        document.write("</tr>");
    }
    document.write("<table>");
</script>
</html>

最新文章

  1. MySQL数据库的初始化mysql_install_db 【基础巩固】
  2. 07OC之KVC、KVO
  3. 【云计算】marathon集群如何升级?
  4. SQL Server 阻止了对组件 &#39;Ad Hoc Distributed Queries&#39; 的 STATEMENT&#39;OpenRowset/OpenDatasource&#39; 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 &#39;Ad Hoc Distributed Queries&#39;。有关启用 &#39;Ad Hoc Distributed Que
  5. postgresql 触发器
  6. hdoj 3785 寻找大富翁【优先队列+sort排序】
  7. BZOJ 1406: [AHOI2007]密码箱( 数论 )
  8. Windows8和MacOS10.9双系统安装及Mac经常使用软件安装--联想E49A
  9. 警惕Dictionary和SortedDictionary的顺序陷阱
  10. 自己编写服务启动脚本(一):functions文件详细分析和说明
  11. iOS中判断照片和相机权限
  12. Shiro源码分析之SecurityManager对象获取
  13. Atitit.如何文章写好 论文 文章 如何写好论文 技术博客
  14. 微信小程序---人脸识别(wx.startFacialRecognitionVerify)
  15. January 30th, 2018 Week 05th Tuesday
  16. 软Raid50制作
  17. Gitlab的SSH配置(linux和windows双版本)
  18. 如何禁用Firefox,chrome浏览器“不安全密码警告”
  19. nginx+php 开启https
  20. Appium1.6启动iOS真机

热门文章

  1. .NET Core 3.0 使用Nswag生成Api文档和客户端代码
  2. Redis 数据结构
  3. 网页解析之BeautifulSoup
  4. 依赖注入利器 - Dagger ‡
  5. 几种常见设计模式在项目中的应用&lt;Singleton、Factory、Strategy&gt;
  6. 正则grep 使用介绍
  7. 【SSL1455&amp;1456】 电子老鼠闯迷宫 &amp; 骑士游行
  8. 不用任何第三方,写一个RTMP直播推流器
  9. NSURLConnection发送GET请求
  10. SpringBoot-HelloWorld(三)