<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="utf-8">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>javascript :prototype 사용 변수 선언 </title>
<script type="text/javascript" src="prototype.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
oldonload();
func();
}
}
}
var Member = Class.create();
Member.prototype={
initialize : function(part){
this.part = part;
},
memberList:function(){
var list = new Array("홍길동","박문수","이몽룡");
var console = document.getElementById("area");
if(console != null){
console.innerHTML += "<b>"+this.part+"</b> 수강생 명단 :<br/> "+list+"<br/>";
} //if
}
}
var PartMember = Class.create();
PartMember.prototype = Object.extend(
new Member,{
memberList : function(){
var list = new Array("이순신","김유신","홍길동");
var console = document.getElementById("area");
if(console != null){
console.innerHTML += "<b>수강과목</b><br/>"+list+"<br/>";
} //if
Member.prototype.memberList.apply(this);
}
}
);
function callFunction(){
var partMember = new PartMember("웹표준 설계반");
partMember.memberList();
}
addLoadEvent(callFunction);
//-->
</SCRIPT>
</head>
<body>
<div id="area"></div>
</body>
</html>