日期:2014-05-16 浏览次数:20338 次
function Pet(the_pet_name, the_form_number){ this.age = 0; this.pet_name = the_pet_name; this.form_number = the_form_number; }
var o={ a:1, b:"aa", c:function(){alert("haiwei o");} }
function object1(){}; object1.prototype.a=4; object1.prototype.b=function(){alert("haiwei object1");};
function createobject(){ var o=new Object(); o.a=1; o.b="w"; o.c=function(){}; return o; }
function test(){ var pet1 = new Pet("barney",0); var pet2 = new Pet("betty",1); alert(pet1.pet_name+"---"+pet2.pet_name); alert(o.a+"---"+o.b); o.c(); alert(object1.prototype.a); object1.prototype.b(); }