摘要: function ClassA (sColor) { this.color = sColor; this.sayColor = function () { alert(this.color); }}function ClassB (sColor,sName) { this.ne... 阅读全文
posted @ 2013-06-05 11:37 Earic 阅读(143) 评论(0) 推荐(0)
摘要: Function.prototype.toString = function () { return "I wish everyone happy !"}function saySth () { alert("55555");}alert(saySth.toString());//I wis... 阅读全文
posted @ 2013-06-05 10:28 Earic 阅读(190) 评论(0) 推荐(0)
摘要: 可以用prototype 属性为任何已有的类定义新方法。例:(判断某项在数组中的位置)Array.prototype.indexof = function (vItem) { for (var i=0; i < this.length; i++) { if (vItem == this[i]) {... 阅读全文
posted @ 2013-06-05 10:18 Earic 阅读(142) 评论(0) 推荐(0)