摘要: 1 var clicky = { 2 wasClicked: function() {}, 3 addListeners: function() { 4 var self = this; 5 $('.clicky').click(function() { 6 self.wasClicked(); 7 }); 8 } 9 };10 clicky.addListeners();11 12 13 //使用apply14 var proxy = function(func, thisObject) {15... 阅读全文
posted @ 2012-07-23 15:42 小猩猩君 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 var Animal = function() {}; 2 3 Animal.prototype.breath = function() { 4 console.log('breath'); 5 }; 6 7 var Dog = function() {}; 8 9 //Dog继承了Animal10 Dog.prototype = new Animal;11 12 Dog.prototype.wag = function() {13 console.log('wag tail');14 };15 16 var dog = new Dog;17 dog.wag 阅读全文
posted @ 2012-07-23 13:18 小猩猩君 阅读(123) 评论(0) 推荐(0) 编辑