<div class="htmlarea"> <textarea id="runcode30608"> </textarea> <br><input onclick="runEx('runcode30608')" type="button" value="运行代码"><input onclick="doCopy('runcode30608')" type="button" value="复制代码"> <input onclick="doSave(runcode30608)" type="button" value="保存代码"> <a href="http://www.jb51.net/article/23421.htm" title="查看具体详情" target="_blank">[Ctrl A 모두 선택 참고: </a>외부 J를 도입해야 하는 경우 실행하려면 새로 고쳐야 합니다. </div>]<br><br>JavaScript 객체지향 프로그래밍<a href="http://www.jb51.net/article/13661.htm"></a>http://www.jb51.net/article/13661.htm<script language="javascript"><!-- function Lecture(name,teacher){ this.name=name; this.teacher=teacher; } Lecture.prototype.display=function(){ return this.teacher+"正在教幼儿园"+this.name+"\n"; } function Schedule(lectures){ this.lectures=lectures; } Schedule.prototype.display=function(){ var str=""; for(var i=0;i<this.lectures.length;i++){ str +=this.lectures[i].display(); } return str; } var mySchedule=new Schedule([ new Lecture("语文","熊老师"), new Lecture("数学","钟老师") ]); alert(mySchedule.display()); // --></script>