Complete Example of Using the employee, client, and project Objects : Objects Object Oriented : Language Basics JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Language Basics » Objects Object Oriented »

 

Complete Example of Using the employee, client, and project Objects




<html>
<head>
  <title>Using the book object</title>
  <script type="text/javascript">
  <!--
  function employee(FirstName, LastName, HomePhone, Ext, EmailAddress, project) {
    this.FirstName = FirstName;
    this.LastName = LastName;
    this.HomePhone = HomePhone;
    this.Ext = Ext;
    this.EmailAddress = EmailAddress;
    this.Project = project;
    this.showSummaryInfo = summaryInfo;
  }
   
  function summaryInfo() {
    objWindow = window.open("""""width=600,height=400");
    objWindow.document.write("<html><body>");
    objWindow.document.write("<h1>Employee Summary Information Sheet</h1>");
    objWindow.document.write("<h2>" this.FirstName + " " this.LastName
                             "</h2>");
    objWindow.document.write("<p><em><Sstrong>Contact Information</strong></em></p>");
    objWindow.document.write("<p>Home Phone: " this.HomePhone + "</p>");
    objWindow.document.write("<p>Ext.: " this.Ext + "</p>");
    objWindow.document.write("<p>Email: " this.EmailAddress + "</p>");
    objWindow.document.write("<p><em><strong>Project Information</strong></em></p>");
    objWindow.document.write("<p>Current Project: " this.project.ProjectName+ "</p>");
    objWindow.document.write("<p>Client: " this.Project.Client.ClientName + "</p>");
    objWindow.document.write("<p>Client: " this.Project.Client.Address + "</p>");
    objWindow.document.write("<p>Client: " this.Project.Client.City + ", " +
                        this.Project.Client.State + " " this.Project.Client.Zip + "</p>");    objWindow.document.write("<p>Development Tool Used: " this.Project.DevTool
                        "</p>");
    objWindow.document.write("</body></html>");
    objWindow.document.close();
  }
   
  function project(ProjectName, client, DevTool) {
    this.ProjectName = ProjectName;
    this.Client = client;
    this.DevTool = DevTool;
  }
   
  function client(ClientName, Address, City, State, Zip) {
    this.ClientName = ClientName;
    this.Address = Address;
    this.City = City;
    this.State = State;
    this.Zip = Zip;
  }
   
  //-->
  </script>
</head>
<body>
  <script type="text/javascript">
  <!--
  CoastTech = new client("client Name""100 street""City","State""11111");
  Coastal = new project("projectl01", CoastTech, "JavaScript");
  Allen = new employee("A""B""111/555-1111""100","a@a.com""Coastal");
  Allen.showSummaryInfo();
  //-->
  </script>
</body>
</html>

           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Language Basics
» Objects Object Oriented