/*
*js对象的构造方式
*/
/*混合构造和原型方式*/
function Car(sColor,iDoors)
{
this.Color=sColor;
this.Doors=iDoors;
this.Drivers=new Array("dd","dds");
}
Car.prototype.showColor=function()
{
alert(this.Color);
}
/*动态原型方式*/
function car(sColor,iDoors)
{
this.Color=sColor;
this.Doors=iDoors;
this.Drivers=new Array("dd","dds");
if(typeof car._initialized=="undefined")
{
Car.prototype.showcolor=function()
{
alert(this.Color);
}
Car._initialized=true;
}
}
/*json方式*/
*js对象的构造方式
*/
/*混合构造和原型方式*/
function Car(sColor,iDoors)
{
this.Color=sColor;
this.Doors=iDoors;
this.Drivers=new Array("dd","dds");
}
Car.prototype.showColor=function()
{
alert(this.Color);
}
/*动态原型方式*/
function car(sColor,iDoors)
{
this.Color=sColor;
this.Doors=iDoors;
this.Drivers=new Array("dd","dds");
if(typeof car._initialized=="undefined")
{
Car.prototype.showcolor=function()
{
alert(this.Color);
}
Car._initialized=true;
}
}
/*json方式*/