标签:
1.prototype 方式
function Person(age){ this.Age = age; } Person.Sex = "男"; Person.prototype.Say = function(){ alert(Person.Sex + this.Age); } var person = new Person(10); person.Say();
2.Object 方式
var Person = new Object(); Person.Sex = "男"; Person.Say = function(age) { alert(this.Sex + age); } Person.Say(12);
3.匿名方式
var Person={ "Sex":"男", "Say":function(age){ alert(this.Sex + age); } }; Person.Say(12);
标签:
原文地址:http://www.cnblogs.com/chinanetwind/p/4897428.html