摘要: var res = "地址"; var arr = res.split('?'); console.log(arr); // var str = arr[1]; // console.log(str); // var arr = str.split('&'); // console.log(arr) 阅读全文
posted @ 2021-12-25 17:15 4zero4NotFound 阅读(39) 评论(0) 推荐(0)
摘要: 防抖 防抖的含义就是让某个时间期限内,事件处理函数只执行一次。 // 防抖 var top = document.querySelectorAll(".tpo"); var t; top.addEventListener('click', function () { clearInterval(t) 阅读全文
posted @ 2021-12-22 20:56 4zero4NotFound 阅读(50) 评论(0) 推荐(0)
摘要: 标签内容: <div class="box1"></div> <div class="box2"></div> var box1 = document.querySelector(".box1"); box1.innerHTML = "<span>你好</span>"; //你好 var box2 阅读全文
posted @ 2021-12-22 20:44 4zero4NotFound 阅读(40) 评论(0) 推荐(0)
摘要: <style> * { margin: 0; padding: 0; } h1 { width: 700px; margin: 100px auto 10px; } div { width: 700px; min-height: 30px; margin: 0 auto; } #hd { width 阅读全文
posted @ 2021-12-21 11:16 4zero4NotFound 阅读(37) 评论(0) 推荐(0)
摘要: <body> <table> <thead> <tr> <th>周天</th> <th>周一</th> <th>周二</th> <th>周三</th> <th>周四</th> <th>周五</th> <th>周六</th> </tr> </thead> <tbody id="tb"></tbody> 阅读全文
posted @ 2021-12-18 14:31 4zero4NotFound 阅读(29) 评论(0) 推荐(0)
摘要: html代码: <div class="bar"> <div class="line"> <div class="dot"></div> </div> </div> //js: // 获取进度条 var bar = document.querySelector(".bar"); var line = 阅读全文
posted @ 2021-12-11 10:18 4zero4NotFound 阅读(48) 评论(0) 推荐(0)
摘要: html代码: <input type="text" id="year"> <input type="text" id="month"> <input type="text" id="day"> <button id="btn">提交</button> js代码: var year = docume 阅读全文
posted @ 2021-12-08 17:37 4zero4NotFound 阅读(284) 评论(0) 推荐(0)
摘要: forEach(value,index,array)方法从头到尾遍历数组,为每个元素调用指定的函数. 用法: //forEach 迭代(遍历)数组 var arr1 = [1,2,3] arr1.forEach(function(value,index,array) { //参数1:元素值 参数2: 阅读全文
posted @ 2021-07-22 14:36 4zero4NotFound 阅读(45) 评论(0) 推荐(0)
摘要: 数组方法之添加元素: push()在数组后面添加一个元素或者多个元素; 用法: var arr = []; arr.push(1); arr.push(2,3,4); console.log(arr); //1,2,3,4 unshift()在数组前面添加一个元素或多个元素; 用法: var arr 阅读全文
posted @ 2021-07-22 12:56 4zero4NotFound 阅读(42) 评论(0) 推荐(0)
摘要: 这三个系列中offset常用于获取元素的位置;client常用于获取元素的大小;scroll常用于获取滚动距离。 区别:offset返回的是自身内容,包括边框和内容区域的宽度,返回数值不带单位。 client返回的是内容区域加padding的宽度,不含边框,返回数值不带单位。 scroll:返回自身 阅读全文
posted @ 2021-07-19 11:09 4zero4NotFound 阅读(38) 评论(0) 推荐(0)