Using the Book Object Constructor
<html>
<head>
<title>Using the book object</title>
<script type="text/javascript">
<!--
function book(title, author, ISBN, subject, rating) {
this.title = title;
this.author = author;
this.ISBN = ISBN;
this.subject = subject;
this.rating = rating;
this.show = show;
}
function show() {
alert(this.title + this.author + this.ISBN + this.subject + this.rating );
}
//--> </script>
</head>
<body>
<script type="text/javascript">
<!--
dbBook = new book("Title", "Author","1-11111-111-1", "Computer", 5);
dbBook.show();
//-->
</script>
</body>
</html>
Related examples in the same category