diff --git "a/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/08.2-\347\202\271\345\207\273\345\205\263\351\227\255.html" "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/08.2-\347\202\271\345\207\273\345\205\263\351\227\255.html" new file mode 100644 index 0000000000000000000000000000000000000000..6725a94b7766866d6167598c695f5b40e0e52e66 --- /dev/null +++ "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/08.2-\347\202\271\345\207\273\345\205\263\351\227\255.html" @@ -0,0 +1,75 @@ + + + + + + + + Document + + + + +
+ 我是广告1 +
X
+
+
+ 我是广告2 +
X
+
+
+ 我是广告3 +
X
+
+ + + + \ No newline at end of file diff --git "a/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/css/index.css" "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/css/index.css" new file mode 100644 index 0000000000000000000000000000000000000000..bf537709ea7ef92a9f3564533646f812e737c65b --- /dev/null +++ "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/css/index.css" @@ -0,0 +1,71 @@ +* { + margin: 0; + padding: 0; +} + +a { + text-decoration: none; + color:#721c24; +} +h1 { + text-align: center; + color:#333; + margin: 20px 0; + +} +table { + margin:0 auto; + width: 800px; + border-collapse: collapse; + color:#004085; +} +th { + padding: 10px; + background: #cfe5ff; + + font-size: 20px; + font-weight: 400; +} +td,th { + border:1px solid #b8daff; +} +td { + padding:10px; + color:#666; + text-align: center; + font-size: 16px; +} +tbody tr { + background: #fff; +} +tbody tr:hover { + background: #e1ecf8; +} +.info { + width: 900px; + margin: 50px auto; + text-align: center; +} +.info input, .info select { + width: 80px; + height: 27px; + outline: none; + border-radius: 5px; + border:1px solid #b8daff; + padding-left: 5px; + box-sizing: border-box; + margin-right: 15px; +} +.info button { + width: 60px; + height: 27px; + background-color: #004085; + outline: none; + border: 0; + color: #fff; + cursor: pointer; + border-radius: 5px; +} +.info .age { + width: 50px; +} \ No newline at end of file diff --git "a/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250\346\241\210\344\276\213.html" "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250\346\241\210\344\276\213.html" new file mode 100644 index 0000000000000000000000000000000000000000..da4bf7c0244d60f0e8028c698fbcb8cc822ac73d --- /dev/null +++ "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250+\345\271\277\345\221\212/\345\255\246\347\224\237\344\277\241\346\201\257\350\241\250\346\241\210\344\276\213.html" @@ -0,0 +1,126 @@ + + + + + + + + 学生信息管理 + + + + +

新增学员

+
+ 姓名: + 年龄: + 性别: + + 薪资: + 就业城市: + +
+

就业榜

+ + + + + + + + + + + + + + + +
学号姓名年龄性别薪资就业城市操作
+ + + + + \ No newline at end of file diff --git "a/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\346\227\266\351\227\264\345\257\271\350\261\241\344\270\216\350\212\202\347\202\271\346\223\215\344\275\234\347\254\224\350\256\260.md" "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\346\227\266\351\227\264\345\257\271\350\261\241\344\270\216\350\212\202\347\202\271\346\223\215\344\275\234\347\254\224\350\256\260.md" new file mode 100644 index 0000000000000000000000000000000000000000..88e0d567efb782cce2c78501271b54b177ae23e5 --- /dev/null +++ "b/\345\271\262\347\272\257\346\254\243/2024.1122 \350\212\202\347\202\271/\346\227\266\351\227\264\345\257\271\350\261\241\344\270\216\350\212\202\347\202\271\346\223\215\344\275\234\347\254\224\350\256\260.md" @@ -0,0 +1,330 @@ +# Web APIs - 第4天 + +> 进一步学习 DOM 相关知识,实现可交互的网页特效 + +- 能够插入、删除和替换元素节点 +- 能够依据元素节点关系查找节点 + +## 日期对象 + + +掌握 Date 日期对象的使用,动态获取当前计算机的时间。 + + +ECMAScript 中内置了获取系统时间的对象 Date,使用 Date 时与之前学习的内置对象 console 和 Math 不同,它需要借助 new 关键字才能使用。 + +### 实例化 + +~~~javascript + // 1. 实例化 + // const date = new Date(); // 系统默认时间 + const date = new Date('2020-05-01') // 指定时间 + // date 变量即所谓的时间对象 + + console.log(typeof date) + + + +~~~ + +### 方法 + + + + ~~~javascript + // 1. 实例化 + const date = new Date(); + // 2. 调用时间对象方法 + // 通过方法分别获取年、月、日,时、分、秒 + const year = date.getFullYear(); // 四位年份 + const month = date.getMonth(); // 0 ~ 11 + ~~~ + + +getFullYear 获取四位年份 + +getMonth 获取月份,取值为 0 ~ 11 + +getDate 获取月份中的每一天,不同月份取值也不相同 + +getDay 获取星期,取值为 0 ~ 6 + +getHours 获取小时,取值为 0 ~ 23 + +getMinutes 获取分钟,取值为 0 ~ 59 + +getSeconds 获取秒,取值为 0 ~ 59 + +### 时间戳 + +时间戳是指1970年01月01日00时00分00秒起至现在的总秒数或毫秒数,它是一种特殊的计量时间的方式。 + +注:ECMAScript 中时间戳是以毫秒计的。 + +~~~javascript + // 1. 实例化 + const date = new Date() + // 2. 获取时间戳 + console.log(date.getTime()) +// 还有一种获取时间戳的方法 + console.log(+new Date()) + // 还有一种获取时间戳的方法 + console.log(Date.now()) + +~~~ + + +获取时间戳的方法,分别为 getTime 和 Date.now 和 +new Date() + +## DOM 节点 + +> 掌握元素节点创建、复制、插入、删除等操作的方法,能够依据元素节点的结构关系查找节点 + +回顾之前 DOM 的操作都是针对元素节点的属性或文本的,除此之外也有专门针对元素节点本身的操作,如插入、复制、删除、替换等。 + +### 插入节点 + +在已有的 DOM 节点中插入新的 DOM 节点时,需要关注两个关键因素:首先要得到新的 DOM 节点,其次在哪个位置插入这个节点。 + +如下代码演示: + +```html + +

插入节点

+

在现有 dom 结构基础上插入新的元素节点

+
+ +
+ + + + +``` + +结论: + +- `createElement` 动态创建任意 DOM 节点 + +- `cloneNode` 复制现有的 DOM 节点,传入参数 true 会复制所有子节点 + +- `appendChild` 在末尾(结束标签前)插入节点 + +再来看另一种情形的代码演示: + +```html + +

插入节点

+

在现有 dom 结构基础上插入新的元素节点

+
+ + + + +``` + +结论: + +- `createElement` 动态创建任意 DOM 节点 + +- `cloneNode` 复制现有的 DOM 节点,传入参数 true 会复制所有子节点 + +- `insertBefore` 在父节点中任意子节点之前插入新节点 + +### 删除节点 + +删除现有的 DOM 节点,也需要关注两个因素:首先由父节点删除子节点,其次是要删除哪个子节点。 + +```html + + + + + + + +``` + +结论:`removeChild` 删除节点时一定是由父子关系。 + +### 查找节点 + +DOM 树中的任意节点都不是孤立存在的,它们要么是父子关系,要么是兄弟关系,不仅如此,我们可以依据节点之间的关系查找节点。 + +#### 父子关系 + +```html + + + + + + +``` + +结论: + +- `childNodes` 获取全部的子节点,回车换行会被认为是空白文本节点 +- `children` 只获取元素类型节点 + +```html + + + + + + + + + + + + + + + + + + + + + + + + + + +
序号课程名难度操作
1HTML初级
2CSS初级
3Web APIs中级
+ + +``` + +结论:`parentNode` 获取父节点,以相对位置查找节点,实际应用中非常灵活。 + +#### 兄弟关系 + +```html + + + + +``` + +结论: + +- `previousSibling` 获取前一个节点,以相对位置查找节点,实际应用中非常灵活。 +- `nextSibling` 获取后一个节点,以相对位置查找节点,实际应用中非常灵活。 + + + + + + + + + + + + + +