zoukankan      html  css  js  c++  java
  • 99乘法表

    JavaScript写出99乘法表

    <!DOCTYPE html>
    <html lang="ch-zn">
    <head>
        <meta charset="UTF-8">
        <title>moban</title>
    
        <style>
        html,body,h1,h2,h3,h4,h5,h6,div,dl,dt,dd,ul,ol,li,p,blockquote,pre,hr,figure,table,caption,th,td,form,fieldset,legend,input,button,textarea,menu{margin:0;padding:0;}
        header,footer,section,article,aside,nav,hgroup,address,figure,figcaption,menu,details{display:block;}
        table{border-collapse:collapse;border-spacing:0;}
        caption,th{text-align:left;font-weight:normal;}
        html,body,fieldset,img,iframe,abbr{border:0;}
        i,cite,em,var,address,dfn{font-style:normal;}
        [hidefocus],summary{outline:0;}
        li{list-style:none;}
        h1,h2,h3,h4,h5,h6,small{font-size:100%;}
        sup,sub{font-size:83%;}
    
        #wrap{
          font-size: 0;
        }
        #wrap span{
          display: inline-block;
    
           70px;
          height: 35px;
          border: 1px solid blue;
          margin: 2px;
    
          font-size: 12px;
          line-height: 35px;
          text-align: center;
        }
    
    
        </style>
    
    </head>
    <body>
    
        <div id="wrap">
    
    
    
        <script src='https://cdn.bootcdn.net/ajax/libs/jquery/3.5.1/jquery.js'></script>
        <script>
            //获取页面标签节点权限
            let oWrap = document.getElementById("wrap"),
            //定义变量初始值
                h = "";
            //第一种for循环排列
            for(let i=0; i<9; i++){
    
                for(let j=0; j<i+1; j++ ){
                    //span标签拼接
                    h += "<span>"+(i+1)+"*"+(j+1)+"="+(i+1)*(j+1)+"</span>";
    
                }
                //每行标签加换行符
                h += "<br>";
            }
            //添加分隔符
            h += "<hr>"
    
            //第二种for循环
            for(let i=0; i<9; i++){
    
                for(let j=0; j<9-i; j++){
                    //span标签的拼接
                    h += `<span>${9-i}*${j+1}=${(9-i)*(j+1)}</span>`;
                }
                //每行标签加换行符
                h += "<br>"
            }
            //每行标签加换行符
            h +="<hr>"
            //将拼接的标签值赋值给节点owrap
            oWrap.innerHTML  = h ;
    
        </script>
    </body>
    <!--
    笔记区域
    
    
    
    
    -->
    
    </html>

  • 相关阅读:
    nyoj-707-A Simple Problem
    nyoj-290-动物统计加强版
    nyoj-27-水池数目
    nyoj-92-图像有用区域
    nyoj-82-迷宫寻宝(一)
    nyoj-289-苹果
    nyoj-311-完全背包
    Docker: docker network 容器网络
    Docker: docker container常用命令实战(2)-数据持久化
    Docker: docker container常用命令实战
  • 原文地址:https://www.cnblogs.com/yhy-blog/p/14238900.html
Copyright © 2011-2022 走看看