以下代碼是從pro javascript techniques書中拷貝出來(lái)的
<script?language="JavaScript">

/**//*
?*?ex:Listing?1-1
?*/

?//Lecture類的構(gòu)造函數(shù)

function?Lecture(?name,?teacher?)?
{
????this.name?=?name;
????this.teacher?=?teacher;
}

//聲明Lecture類的方法display

Lecture.prototype.display?=?function()
{
????return?this.teacher?+?"?is?teaching?"?+?this.name;
};


//Schedule類的構(gòu)造函數(shù)

function?Schedule(?lectures?)?
{
????this.lectures?=?lectures;
}

//聲明Lecture類的方法display

Schedule.prototype.display?=?function()
{
????var?str?=?"";
????for?(?var?i?=?0;?i?<?this.lectures.length;?i++?)
????????str?+=?this.lectures[i].display()?+?"<br/>";
????????return?str;
};

//?創(chuàng)建Schedule類的對(duì)象mySchedule
var?mySchedule?=?new?Schedule([
????new?Lecture(?"Gym",?"Mr.?Smith"?),
????new?Lecture(?"Math",?"Mrs.?Jones"?),
????new?Lecture(?"English",?"TBD"?)
????]
);

document.writeln(?mySchedule.display()?);
</script>


















































用的最多的還是簡(jiǎn)單的function ??!
的靈活語(yǔ)法
XXX.prototype.evtProcess
在別的方法里為一元素注冊(cè)事件時(shí),寫這個(gè)方法。實(shí)際處理時(shí)有問(wèn)題
不知道樓主遇到過(guò)沒(méi)?