摘要:1.myList.cloneNode(true); 在参数为true的情况下,执行深复制,也就是复制节点及其整个子节点树,包括属性2. myList.cloneNode(false); 在参数为false 的情况下,执行浅复制,即只复制节点本身,包括属性 cloneNode()方法不会复制添加到D...
阅读全文
摘要:1.var name = "The Window";var object = {name : "My Object",getName: function(){return this.name;}};这里的getName()方法只简单地返回this.name 的值。以下是几种调用object.getN...
阅读全文
摘要:1.原型链function SuperType(){this.property = true;}SuperType.prototype.getSuperValue = function(){return this.property;};function SubType(){this.subprope...
阅读全文
摘要:1.工厂模式function createPerson(name, age, job){var o = new Object();o.name = name;o.age = age;o.job = job;o.sayName = function(){alert(this.name);};retur...
阅读全文
摘要:function createComparisonFunction(propertyName) {return function(object1, object2){var value1 = object1[propertyName];var value2 = object2[propertyNam...
阅读全文
摘要:alert('2008-01-02'.replace(/-0(\d)-0(\d)/, '年$1月$2日')); var ff = new asd(); alert(ff.it1); function asd() { this.it1 = "aa"; } asd.prototype.ff1 =...
阅读全文