<html>
<head>
<title>First Object</title>
<script type="text/javascript">
function Song (title) {
this.title = title;
}
function printTitle() {
alert(this.title);
}
var someSong = new Song("Title");
Song.prototype.print = printTitle;
var anotherSong = new Song("Another Title");
anotherSong.print();
</script>
</head>
<body>
</body>
</html>
|