function Lecture(name,teacher){//类Lecture
this.name=name;
this.teacher=teacher;
}
Lecture.prototype.display=function(){//Lecture的方法display
return this.teacher+" teach"+" "+this.name;
}
lectures=new Array();
lectures.push(new Lecture("yuwen","zhangsan"));
lectures.push(new Lecture("shuxu","lisi"));
lectures.push(new Lecture("english","wangwu"));
for(var loopIndex=0;loopIndex< lectures.length; loopIndex++){
document.write(lectures[loopIndex].display()+"
");
}
阅读(1200) | 评论(0) | 转发(0) |