使用原生js实现todolist增删改查,弹框复用

手写弹框样式+模块化拆分,实现复用弹框(弹框可随机变换颜色)
首先需要在github上将require.js文件复制到本地:
requirejs/require.js at master · requirejs/requirejs (github.com)

我写的是todolist小案例,最终的效果

文件结构如下:

下面为详细代码:
1.index.html文件:
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    //css样式,方法一:使用link将css文件引入
    <!-- <link rel="stylesheet" href="./css/index.css"> -->
    //我这里使用了方法二,直接在style标签内引入,两种方法都可以
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .container {
            width: 630px;
            margin: 30px auto;
        }
        .top {
            margin-bottom: 18px;
        }

        table {
            border-collapse: collapse;
        }

        table tr {
            height: 40px;
            text-align: center;
            border-bottom: 1px dashed #767676;
        }

        table td {
            border-bottom: 1px dashed #767676;
        }
    </style>
</head>

<body>
    //页面结构不多说,相信大家都能看懂
    <div class="container">
        <div class="top">
            <button class="add">添加信息</button>
        </div>
        <div class="main">
            <table width="639px" cellspacing="0">
                <thead>
                    <tr>
                        <th>姓名</th>
                        <th>班级</th>
                        <th>年龄</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody class="tb">
                    <!-- <tr>
                        <td>春娇</td>
                        <td>一年二班</td>
                        <td>19</td>
                        <td>
                            <button class="catch">查看</button>
                            <button class=&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值