javascript 创建对象


javascript 创建对象

<html>
   <head>
      <title>User-defined objects</title>

      <script type = "text/javascript">
         var book = new Object();   // Create the object
         book.subject = "Perl";     // Assign properties to the object
         book.author  = "Mohtashim";
      </script>

   </head>

   <body>

      <script type = "text/javascript">
         document.write("Book name is : " + book.subject + "<br>");
         document.write("Book author is : " + book.author + "<br>");
      </script>

   </body>
</html>