
JavaScript面向对象编程
beattwo
这个作者很懒,什么都没留下…
展开
-
仿Java类StringBuffer类性能测试
[code="js"] StringBuffer = function(){ this.arr = new Array(); this.appendChild = function(str){ this.arr.push(str); } this.toString = function(){ return this.arr.join(""); } } ...2009-04-08 17:42:32 · 158 阅读 · 0 评论 -
Javascript 面向对象编程原型对象方法(补充)
[code="js"] //Json对象 var programmer = { name:"kevin", age:25, displayInfo : function(){ alert("My name is "+this.name+", I'm "+this.age+" year...原创 2009-11-27 06:10:41 · 103 阅读 · 0 评论 -
Javascript 面向对象编程使用接口的方法
[code="js"] var Interface = function(interfaceName,interfaceMethods){ if(arguments.length!=2){ alert("Interface expected 2 arguments,one is for Interface Name, and the other is the Array for me...原创 2009-11-23 10:23:24 · 101 阅读 · 0 评论 -
Javascript 面向对象编程定义接口的一种方法
[code="js"] //定义一个接口函数 var Interface = function(interfaceName,interfaceMethods){ if(arguments.length!=2){ alert("Interface expected 2 arguments,one is for Interface Name, and the other is the ...原创 2009-11-23 10:14:40 · 100 阅读 · 0 评论 -
Javascript 面向对象编程定义对象函数的方法
[code="js"] //A.利用传统的原始方法定义对象的方法(函数) 一 function Programmer(name,age,position){ this.name = name; this.age = age; this.position = position; this.disp...原创 2009-11-17 23:54:51 · 126 阅读 · 0 评论 -
Javascript 面向对象编程继承方法四(原型继承)
[code="js"] function Person(name,age,position){ this.name = name; this.age = age; this.position = position; } Person.prototype.displayInfo ...原创 2009-11-17 01:19:00 · 106 阅读 · 0 评论 -
Javascript 面向对象编程继承方法三(Apply继承)
[code="js"] function Person(name,age,position){ this.name = name; this.age = age; this.position = position; this.displayInfo = function(){ ...原创 2009-11-17 01:18:02 · 103 阅读 · 0 评论 -
Javascript 面向对象编程继承方法二(Call继承)
[code="js"] function Person(name,age,position){ this.name = name; this.age = age; this.position = position; this.displayInfo = function(){ ...原创 2009-11-17 01:16:40 · 89 阅读 · 0 评论 -
Javascript 面向对象编程继承方法一(普通继承)
[code="js"] function Person(name,age,position){ this.name = name; this.age = age; this.position = position; this.displayInfo = function(){ ...原创 2009-11-17 01:14:59 · 152 阅读 · 0 评论 -
Javascript 面向对象编程动态原型方法(Dynamic prototype method)
[code="js"] function Person(name,age){ this.name = name; this.age = age; if (typeof Person._initialized == "undefined") { Person.pr...原创 2009-11-17 01:13:13 · 144 阅读 · 0 评论 -
Javascript 面向对象编程原型prototype的注意问题
[code="js"] function Person(){ } Person.prototype.names= new Array(“Kevin”); var person1 = new Person(); var person2 = new Person(); person1.n...原创 2009-11-17 00:18:12 · 118 阅读 · 0 评论 -
仿Java类HashMap的JavaScript实现
[code="js"] /* *@author:chenyuanpeng *QQ:174554431 */ function HashMap(){ this.data = new Array();//定义数组属性 //返回指定键在此标识映射中所映射的值 this.put...2009-02-16 02:55:33 · 160 阅读 · 0 评论