<html>
<head><title>新建文档</title></head>
<body>
<script language="javascript">
<!--
var tempBook = new Object();//创建一个对象,并保存在一个变量中
tempBook.title = "TempBook1";//设置该对象的一个属性
//设置更多的属性,注意其层次关系
tempBook.chapter1 = new Object();
tempBook.chapter1.title ="第一章";
tempBook.chapter1.pages = 25;
tempBook.chapter2 = {title:"第二章",pages:30};
//调用该对象的某些属性
alert("输出结果:"+"\n\t\n\t"+tempBook.title+"\n\t"+"Chapter 1: "
+tempBook.chapter1.title+"\n\t"+"chapter 2: "+ tempBook.chapter2.title);
//-->
</script>
</body>
</html>