首页 > 其他分享 >trainTest.html

trainTest.html

时间:2023-10-25 14:01:04浏览次数:29  
标签:item trainTest xhr html var td document row

<!DOCTYPE html>
<html>
<head>
    <%include("/WEB-INF/pages/include/listCss.btl") {}%>
    <link href="https://cdn.xiaoluxueche.com/staticSource/bootstrap-switch/bootstrap-switch.min.css" rel="stylesheet">
    <%include("/WEB-INF/pages/include/listScript.btl") {}%>
    <script src="https://cdn.xiaoluxueche.com/staticSource/bootstrap-switch/bootstrap-switch.min.js"></script>
</head>
<body>
<h1>测试</h1>
<div id="table-wrapper">
    <table>
        <thead>
        <tr>
            <th>描述</th>
            <th>类型</th>
            <th>时间</th>
            <th>创建人</th>
            <th>创建ip</th>
        </tr>
        </thead>
        <tbody id="table-body">
        <!-- 这里将通过 JavaScript 动态添加表格行 -->

        </tbody>
    </table>
</div>

</body>
<script>
    window.onload = function() {
        var xhr = new XMLHttpRequest();
        xhr.onreadystatechange = function() {
            if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {
                var response = JSON.parse(xhr.responseText);
                var responseData = response.data
                var res = responseData.list
                window.console.log(res)
                // 获取表格主体的引用
                var tableBody = document.getElementById("table-body");

                // 遍历数据数组,动态创建并添加表格行
                res.forEach(function(item) {
                    var row = document.createElement("tr");

                    var descriptionCell = document.createElement("td");
                    descriptionCell.textContent = item.logTitle;
                    row.appendChild(descriptionCell);

                    var typeCell = document.createElement("td");
                    typeCell.textContent = item.modelName;
                    row.appendChild(typeCell);

                    var timeCell = document.createElement("td");
                    timeCell.textContent = item.createdate
                    ;
                    row.appendChild(timeCell);

                    var creatorCell = document.createElement("td");
                    creatorCell.textContent = item.createperson;
                    row.appendChild(creatorCell);

                    var ipCell = document.createElement("td");
                    ipCell.textContent = item.createIp;
                    row.appendChild(ipCell);

                    tableBody.appendChild(row);
                });
            }
        };
        xhr.open('GET', '${basePath}/manager/period/list', true);
        xhr.send();
    };
</script>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 20px;
    }

    h1 {
        text-align: center;
        margin-bottom: 20px;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    th, td {
        padding: 10px;
        text-align: left;
    }

    th {
        background-color: #f2f2f2;
        font-weight: bold;
    }

    tr:nth-child(even) {
        background-color: #f9f9f9;
    }

    tr:hover {
        background-color: #e6e6e6;
    }
</style>
</html>

 

标签:item,trainTest,xhr,html,var,td,document,row
From: https://www.cnblogs.com/mingruifeng/p/17787062.html

相关文章

  • html制作一个聊天软件
    需要的物件:1.一个云服务器2.一双会cv的手3.出了问题会自己百度的脑子 首先,直接粘代码<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><HEAD><TITLE>Vue学习</TITLE></HEA......
  • html 数字,字母 超出标签设定的宽度问题
    前因:做一个表格页面时,其中有一列网址数据,但这些内容总会超出表格设定的宽度范围,中文就不会,就类似下面这样: 解决(样式中增加下面代码):word-wrap:break-word;  效果: ......
  • [DataFocus Cloud 对比 QuickBI](https://www.datafocus.ai/comparison/quick-bi.html
    产品对比对比Tableau对比PowerBI对比QuickSight对比Qlik对比ThoughtSpot对比FineBI对比SmartBI对比永洪BI对比QuickBI对比百度Sugar......
  • 安装dita-ot并使用dita-ot生成pdf和html文档
    java版本dita-ot版本测试文档生成的文件包可以在dita-ot官网下载1.安装jdkhttps://blog.csdn.net/bestsongs/article/details/1229390812.解压dita-ot的zip包就可以了3.使用方法输出的文件在......
  • 【实测有效】.epub文件如何批量转换为word/AZW3/MOBI/DOCX/RTF/TXT/HTMLZ? 附工具下载
    常见电子书格式有很多种,其中有一种.epub格式,这种格式的文件比较多,也比较容易找到,阅读器也有多款软件支持。国内用的相对多点的比如ApabiReader。有时候,.epub文件明明是正常的,但ApabiReader却会报错而无法打开。上篇优爱酷分享了如何将.epub文件转换为可编辑的word,但是手动操作比......
  • html基础内容
    1.认识htmlhtml是超文本标签语言,其中超文本代表它不仅仅只有文本、还可能会有视频、图片、音频等、标签语言代表它是由一个一个标签组成的语言。html中有双标签和单标签。单标签:由一个标签组成。比如:<hr>、<br>双标签:由开始标签和结束标签组成。比如:<h1></h1><h1>表示开始标......
  • 【HTML】第四讲:有序列表和无序列表
    今天你进步了吗!@放纵lili一、有序列表。1、以数字和字母等可以表示顺序的符号为项目符号来排列列表项的列表为有序列表。2、形式:共有以下五种。3、基本语法:#记忆起来也很容易的:ol就是orderlist有序列表li就是列表。4、<li>标签里可以任意嵌套,但是<ol>标签,就只能嵌套<li>标签。5、t......
  • How to use regular expression to match a special meta tag in html string using j
    HowtouseregularexpressiontomatchaspecialmetataginhtmlstringusingjavascriptAllInOnemetatagerror❌consthtml=`<!DOCTYPEhtml><htmllang="en"><head><metaname="twitter:card"content......
  • HTML
          ......
  • springboot使用form标签在两个html页面之间实现界面跳转,出现405问题,但是一刷新就能出
    问题描述在我使用form标签的action属性实现两个html页面之间的跳转,但是出现了这样的问题:问题解决我尝试将这一块内容去掉:然后再次尝试:页面出来啦~问题解决啦~~......