table2excel.js导出数据 与django结合

2 篇文章 0 订阅

链接:https://pan.baidu.com/s/1DgPXTK54hRJqBWxEmx1Bgg
提取码:007l

{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生信息</title>
    <!-- 设置标题中的图标 -->
    <link type="image/x-icon" rel="icon" href="{% static 'images/ilync.ico' %}"/>
    <!-- 引入外部的CSS文件 -->
    <link type="text/css" rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
    <link type="text/css" rel="stylesheet" href="{% static 'css/index.base.css' %}">
    <!-- 引入jquery文件  -->
    <script src="{% static 'js/jquery-3.4.1.min.js' %}"></script>
    <script src="{% static 'js/table2excel.js' %}"></script>
    <style>
        .btnEixt {
            background-color: #a9c3cd;
            border: 0.5px;
            width: 100px;
            height: 50px;
            border-radius: 12%;
            font-size: 20px;
            margin-left: 20px;
        }

        .btnEixt:hover {
            background-color: rgb(117, 200, 221);
        }
    </style>
</head>
<body>
<!-- 页面标题 -->
<div class="header">
    <div class="header_center">
        <img src="{% static 'images/logo.png' %}">
        <div>学生成绩管理系统</div>
    </div>
</div>
{# 展示学生姓名#}
<div class="userNameCenter">
    <h2>姓名:{{ stuName }}</h2>
    <a href="http://127.0.0.1:8000/">
        <button class="btnEixt">退出</button>
    </a>
     <button id="export"  class="btnEixt" >导出成绩</button>
</div>
<div class="content">
    <table class="table table-striped table-bordered table-hover" id="data">
        <thead>
        <tr>
            <th>课程名称</th>
            <th>成绩</th>
            <th>教师名称</th>
        </tr>
        </thead>
        <tbody>
  
            <tr>
                <td>{{ JS }}</td><!-- 课程-->
                <td>{{ 98 }}</td><!-- 成绩-->
                <td>{{ teacher }}</td><!-- 教师名称-->
            </tr>

        </tbody>
    </table>
</div>
</div>
</body>
</html>
<script>
    var table2excel = new Table2Excel();
            document.getElementById('export').addEventListener('click', function() {
                table2excel.export(document.getElementById('data'));
            });
</script>

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值