<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html id="html40L" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Live Help!</title>
<style type="text/css">
<!--
p { border-bottom : 2px solid #eee; color : #800080; line-height : 1.6; padding-bottom : .500em; margin-left: .700em; letter-spacing : 3px; margin-top : 2em; white-space : nowrap; }
span { color : #365d95; }
-->
</style>
<script type="text/javascript">
<!--
var Faculty = function( name, dept ) {
this.name = (( name ) ? name : "undefined " + ( typeof( this ) ) + ": name" );
this.dept = (( dept ) ? dept : "undefined " + ( typeof( this ) ) + ": dept" );
/* Commented Block Started
this.getname = function( name ) { }; // Creating Empty function. And also you forgot to include brackets, so that's why it's messing the whole program.
this.setname = function( name ) { };
this.getdata = function() { };
this.setdata = function( dept ) { };
this.name.toString = function() { };
this.dept.toString = function() { };
*/// Commented Block Ended
};
var Course = function( name, times, instructorName, instructorDept ) {
var instructor;
this.name = (( name ) ? name : "undefined " + ( typeof( this ) ) + ": name" );
this.times = (( times ) ? times : "undefined " + ( typeof( this ) ) + ": times" );
this.instructor = new Faculty( instructorName, instructorDept );
/* this.getname = function() { };
this.setname = function( name ) { };
this.gettimes = function() { };
this.settimes = function( dept ) { };
this.getinstructor() = function();
this.setinstructor(Faculty) { };
this.name.toString = function() { }; */
};
// -->
</script>
</head>
<body>
<div id="main">
<script type="text/javascript">
<!--
/* Contructor Faculty() Usage Example: */
var fac1 = new Faculty("Dr. Smith", "Math" );
document.writeln("\n<p>New Faculty: <span>" + (( fac1.name ) ? fac1.name : fac1["name"] ) + "</span><br>Department: <span>" + (( fac1.dept ) ? fac1.dept : fac1["dept"] ) + "</span><br>" );
document.writeln("Again: <span>" + fac1.name + "</span>, <span>" + fac1.dept + "</span></p>\n" );
var fac2 = new Faculty();
fac2["name"] = "Dr. Jones";
fac2["dept"] = "CS";
document.writeln("\n<p>New Faculty: <span>" + (( fac2.name ) ? fac2.name : fac2["name"] ) + "</span><br>Department: <span>" + (( fac2.dept ) ? fac2.dept : fac2["dept"] ) + "</span></p>\n" );
var crs1 = new Course("COMP332", "MWF 1: 00-1:50", "Dr. Green", "CS" );
document.writeln("<p>New course: <span>" + (( crs1.name ) ? crs1.name : crs1["name"] ) + "</span><br>Time: <span>" + (( crs1.times ) ? crs1.times : crs1["times"] ) + "</span><br>Instructor: <span>" );
document.writeln( crs1.instructor.name + "</span><br>" + "Department: <span>" + crs1.instructor.dept + "</span></p>" );
// -->
</script>
</div>
</div>
</body>
</html>