摘要: 增: document.createElement(); 创建一个新元素 document.createTextNode();创建一个文本节点 document.createComment();创建一个注释 document.createDocumentFragment();创建文档碎片 删: pa 阅读全文
posted @ 2020-02-03 15:53 另一场风花雪月 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 遍历节点树 parentNode -> 父节点(最顶端的parentNode为#document) childNodes -> 子节点们 (节点类型:元素,属性,文本,注释,document,DocumentFragment) firstChild -> 第一个子节点 lastChild -> 最后 阅读全文
posted @ 2020-01-21 16:11 另一场风花雪月 阅读(369) 评论(1) 推荐(0) 编辑
摘要: 1.函数预编译过程 this >window。 2.全局作用域里this >window。 3.call/apply 可以改变函数运行时this指向。 4.obj.func(); func()里面的this指向boj。 阅读全文
posted @ 2019-12-29 15:10 另一场风花雪月 阅读(113) 评论(0) 推荐(0) 编辑
摘要: function Father () { } Father.prototype.lastName = "Zhang"; function Son () { } Son.prototype = Father.prototype; function F () {} function inherit (T 阅读全文
posted @ 2019-12-21 16:37 另一场风花雪月 阅读(203) 评论(0) 推荐(0) 编辑
摘要: Person.prototype.name = "sunny"; function Person () { } var person = new Person(); Person.prototype = { name : "cherry" } Person的name最终为“sunny”,原因如下: 阅读全文
posted @ 2019-12-13 17:54 另一场风花雪月 阅读(91) 评论(0) 推荐(0) 编辑
摘要: var obj = { name : "XiaoQi", sex : 'female', age : 18, stature : 160, weight : 90, apple : function () { console.log('I am eating apple!!!'); this.wei 阅读全文
posted @ 2019-12-08 19:33 另一场风花雪月 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 1.在函数体最前面隐式地加上this = {} 2.执行 this.xxx = xxx; 3.在函数最后隐式return this 阅读全文
posted @ 2019-12-06 17:21 另一场风花雪月 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 包装类习题 阅读全文
posted @ 2019-12-06 17:16 另一场风花雪月 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 写4个内容为a的li标签,要求加入一个单击事件,单击之后打印该“a”的索引,方法如图2,但打印出来的结果全是4。因为将console.log放入onclick事件中已发送到外部,形成了闭包,(此外部已是javascript标签之外) 要求打印对应索引0 - 3. 方法如下 将函数表达式写入立即执行函 阅读全文
posted @ 2019-12-01 15:32 另一场风花雪月 阅读(169) 评论(0) 推荐(0) 编辑
摘要: function test () { var arr = []; for (var i = 0; i < 10; i ++) { arr[i] = function () { document.write(i + " "); } } return arr; } var myArr = test(); 阅读全文
posted @ 2019-11-29 18:01 另一场风花雪月 阅读(527) 评论(0) 推荐(0) 编辑