function Phone(NUM,TITLE){
this.num = NUM;//实例变量,用"对象.属性"访问
this.title = TITLE;
this.print = function (){
alert("num:"+this.num+"title:"+this.title);
}
}
Phone.size = 111 ;//类变量,只能用"类名.属性"访问
Phone.prototype.color = "red";//实例变量,用"对象.属性"访问
var ph = new Phone(123,"aa");
ph.print();//num:123title:aa
alert(Phone.size);//111
alert(Phone.color);//undefined
alert(ph.size);//undefined
alert(ph.color);//red
转载于:https://www.cnblogs.com/Mygirl/archive/2012/03/29/2423011.html