摘要:
增: document.createElement(); 创建一个新元素 document.createTextNode();创建一个文本节点 document.createComment();创建一个注释 document.createDocumentFragment();创建文档碎片 删: pa 阅读全文
摘要:
遍历节点树 parentNode -> 父节点(最顶端的parentNode为#document) childNodes -> 子节点们 (节点类型:元素,属性,文本,注释,document,DocumentFragment) firstChild -> 第一个子节点 lastChild -> 最后 阅读全文
摘要:
1.函数预编译过程 this >window。 2.全局作用域里this >window。 3.call/apply 可以改变函数运行时this指向。 4.obj.func(); func()里面的this指向boj。 阅读全文
摘要:
function Father () { } Father.prototype.lastName = "Zhang"; function Son () { } Son.prototype = Father.prototype; function F () {} function inherit (T 阅读全文
摘要:
Person.prototype.name = "sunny"; function Person () { } var person = new Person(); Person.prototype = { name : "cherry" } Person的name最终为“sunny”,原因如下: 阅读全文
摘要:
var obj = { name : "XiaoQi", sex : 'female', age : 18, stature : 160, weight : 90, apple : function () { console.log('I am eating apple!!!'); this.wei 阅读全文
摘要:
写4个内容为a的li标签,要求加入一个单击事件,单击之后打印该“a”的索引,方法如图2,但打印出来的结果全是4。因为将console.log放入onclick事件中已发送到外部,形成了闭包,(此外部已是javascript标签之外) 要求打印对应索引0 - 3. 方法如下 将函数表达式写入立即执行函 阅读全文
摘要:
function test () { var arr = []; for (var i = 0; i < 10; i ++) { arr[i] = function () { document.write(i + " "); } } return arr; } var myArr = test(); 阅读全文