オブジェクトのメソッドを定義するには

<html>
<head>
<title>Sample</title>
</head>
<body>
<script type="text/javascript"><!--
function myComputer(nName)
{
this.CPU = "UltraSPARC IV";
this.Clock = "1.2GHz";
this.Memory = "576GB";
this.Nickname = nName;
this.spec = function()
{
document.write(this.CPU+"<br>");
document.write(this.Clock+"<br>");
document.write(this.Memory+"<br>");
document.write(this.Nickname+"<br>");
}
}
myObj = new myComputer("自宅サーバー");
myObj.spec();
// --></script>
</body>
</html>
・サンプルを実行
・サンプルをダウンロード
逆引きクイックリファレンス JavaScript 説明などは本書を参考にしてください。