摘要: 在javascript中定义类或对象有下面几种常用的方式:工厂方式functioncreateCar(color,doors,mpg){vartempCar=newObject;tempCar.color=color;tempCar.doors=doors;tempCar.mpg=mpg;tempCar.showColor=function(){alert(this.color);};returntempCar;}varcar1=createCar("red",4,23);varcar2=createCar("blue",3,25);car1.showC 阅读全文
posted @ 2012-10-19 12:31 JackZ 阅读(1198) 评论(7) 推荐(1)