SlideShare a Scribd company logo
1 of 10
window.onload = createCarObject;
function createCarObject()
{
var make =
document.getElementById("carsMake").value;
var model =
document.getElementById("carsModel").value;
var year = document.getElementById("carsYear").value;
document.getElementById("carsMake").innerHTML =
make;
document.getElementById("carsModel").innerHTML =
model;
document.getElementById("carsYear").innerHTML = year;
var newCar = new Car(make, model, year);
newCar.speed();
newCar.drive();
newCar.cruise();
}
function updateDocument() {
this.make = document.getElementById("carsMake").value;
this.model =
document.getElementById("carsModel").value;
this.year = document.getElementById("carsYear").value;
document.getElementById("CarsMake").innerHTML =
this.make;
document.getElementById("CarsModel").innerHTML =
this.model;
document.getElementById("CarsYear").innerHTML =
this.year;
this.speeding =
document.getElementById("speed").checked;
this.driving = document.getElementById("drive").checked;
this.cruising =
document.getElementById("cruise").checked;
if (this.year >= 2000 && this.speeding) {
document.getElementById("speeding").innerHTML =
" Yes, " + this.name + " says Nice set of wheels man! ";
} else if (this.speeding) {
document.getElementById("speeding").innerHTML =
" Yes, " + this.name + " Yes, it's Purring?! ";
} else {
document.getElementById("speeding").innerHTML =
" No, " + this.name + " No, it's Resting. ";
}
if (this.driving) {
document.getElementById("driving").innerHTML =
"Yes, " + this.name + " I'm a Low Rider!";
} else {
document.getElementById("driving").innerHTML =
"No, " + this.name + " Getting to work!";
}
if (this.cruising) {
document.getElementById("cruising").innerHTML =
"Yes, " + this.name + "I'm a Racer";
} else {
document.getElementById("cruising").innerHTML =
"No, " + this.name + "Radar Trap Ahead!";
}
}
function Car(make, model, year) {
this.make = make;
this.model = model;
this.year = year;
Car.prototype.speeding =
document.getElementById("speed").checked;
Car.prototype.driving =
document.getElementById("drive").checked;
Car.prototype.cruising =
document.getElementById("cruise").checked;
Car.prototype.speed = function() {
if (this.speed >= 2000 && this.speeding) {
document.getElementById("speeding").innerHTML = "
Yes, " + this.name + " Yes, it's Purring! ";
} else if (this.speeding) {
document.getElementById("speeding").innerHTML = "
Yes, " + this.name + " No, it's resting! ";
} else {
document.getElementById("speeding").innerHTML = " No,
" + this.name + " is being very quiet. ";
}
};
Car.prototype.drive = function() {
if (this.sitting) {
document.getElementById("driving").innerHTML = "Yes,
" + this.name + " I'm a Low Rider!";
} else {
document.getElementById("driving").innerHTML = "No, "
+ this.name + " Getting to work!";
}
};
Car.prototype.cruise = function() {
if (this.cruising) {
document.getElementById("cruising").innerHTML = "Yes,
" + this.name + "I'm a Racer!";
} else {
document.getElementById("cruising").innerHTML = "No,
" + this.name + "Radar Trap Ahead!";
}
};
}
This page requires JavaScriptEM228 - Scripting for the Web
with JavaScript
Creating Dynamic Car Objects Lab
Enter the Car's Make, Model and Year below:
Make:
Model:
Year:
Car is Running
Car is Cruising
Car is Speeding
The Car's MakeThe Car's ModelThe Car's YearIs the
car Running?Is the car Cruising?Is the car Speeding?
h1, h2, h3, div {
text-align: center;
}
body {
background-color: white;
color: #A90232;
}
table {
border: #A90232;
}
th {
text-align: center;
font-weight: bold;
color: black;
}
td {
text-align: center;
font-weight: bold;
}
EM228
Requirements
You will use the DynamicDogObject’s HTML/JS/CSS files as
templates - in order to create a set of new DynamicCarObject’s
HTML/JS/CSS files.
CSS: Copy DogObject.css from Class Content - the one we used
for dynamic dog.
Make the modifications (if necessary) so the ids/classes
work with the new
DynamicCarObject.html and DynamicCarObject.js code
that you will create.
HTML: Copy DynamicDogObject.html as a Template to make
these Modifications:
1. Create the Banner to say “Creating Dynamic Car Objects”
2. below the banner say “Enter the Car’s Make, Model and Year
3. rename the labels for the textboxes appropriately
4. label the checkboxes as Car is running - Car is Cruising - Car
is Speeding
5. rename the table elements appropriately
a. For the textbox answers:
i. The Car’s Make is <make>
ii. The Car’s Model is <model>
iii. The Car’s Year is:
1. if < 2000 “Seriously Dude?”
2. if >= 2000 “Nice Set of Wheels Man!”
b. For the checkbox answers:
i. checked = “Yes, it’s Purring” unchecked = “No, it’s Resting”
ii. checked = “I’m a Low Rider” unchecked = “Getting to
Work”
iii. checked = “I’m a Racer” unchecked = “Radar Trap Ahead”
JS: Copy DynamicDogObject.js as a Template & make
Necessary Modifications
Upload to the ClassWeb for me to check there and submit to the
portal as well

More Related Content

Similar to Create Dynamic Car Objects

The Future of CSS with Web Components
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web ComponentsColdFusionConference
 
I need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdfI need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdfadianantsolutions
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Ahmed Moawad
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training Patrick Schroeder
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1Paras Mendiratta
 
#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docx#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docxmayank272369
 
Angular directive filter and routing
Angular directive filter and routingAngular directive filter and routing
Angular directive filter and routingjagriti srivastava
 
I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfaggarwalshoppe14
 
ASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic DataASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic Datamicham
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用LearningTech
 
Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)Kasper Reijnders
 
For the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdfFor the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdfarjunhassan8
 
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfpublicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfANGELMARKETINGJAIPUR
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyMark Meeker
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentJermaine Oppong
 
Predicting model for prices of used cars
Predicting model for prices of used carsPredicting model for prices of used cars
Predicting model for prices of used carsHARPREETSINGH1862
 

Similar to Create Dynamic Car Objects (20)

The Future of CSS with Web Components
The Future of CSS with Web ComponentsThe Future of CSS with Web Components
The Future of CSS with Web Components
 
I need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdfI need to do the followingAdd a new item to the inventory m.pdf
I need to do the followingAdd a new item to the inventory m.pdf
 
Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1Exploring Angular 2 - Episode 1
Exploring Angular 2 - Episode 1
 
Java Script Best Practices
Java Script Best PracticesJava Script Best Practices
Java Script Best Practices
 
Capstone ms2
Capstone ms2Capstone ms2
Capstone ms2
 
Satchmo
SatchmoSatchmo
Satchmo
 
Angular 2 Essential Training
Angular 2 Essential Training Angular 2 Essential Training
Angular 2 Essential Training
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1
 
#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docx#include iostream#include string#include iomanip#inclu.docx
#include iostream#include string#include iomanip#inclu.docx
 
Oop in java script
Oop in java scriptOop in java script
Oop in java script
 
Angular directive filter and routing
Angular directive filter and routingAngular directive filter and routing
Angular directive filter and routing
 
I need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdfI need this code, to show ALL inventory items, then with the remove .pdf
I need this code, to show ALL inventory items, then with the remove .pdf
 
ASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic DataASP.Net 3.5 SP1 Dynamic Data
ASP.Net 3.5 SP1 Dynamic Data
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用
 
Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)Jan 2017 - a web of applications (angular 2)
Jan 2017 - a web of applications (angular 2)
 
For the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdfFor the following questions, you will implement the data structure to.pdf
For the following questions, you will implement the data structure to.pdf
 
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdfpublicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
publicclass VehicleParser {publicstatic Vehicle parseStringToVehic.pdf
 
Orbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case StudyOrbitz and Spring Webflow Case Study
Orbitz and Spring Webflow Case Study
 
Web Components: The future of Web Application Development
Web Components: The future of Web Application DevelopmentWeb Components: The future of Web Application Development
Web Components: The future of Web Application Development
 
Predicting model for prices of used cars
Predicting model for prices of used carsPredicting model for prices of used cars
Predicting model for prices of used cars
 

More from alanfhall8953

With regards to this article, I agree and disagree on certain leve.docx
With regards to this article, I agree and disagree on certain leve.docxWith regards to this article, I agree and disagree on certain leve.docx
With regards to this article, I agree and disagree on certain leve.docxalanfhall8953
 
WIT Financial Accounting Test Ch.docx
WIT                   Financial Accounting Test                 Ch.docxWIT                   Financial Accounting Test                 Ch.docx
WIT Financial Accounting Test Ch.docxalanfhall8953
 
Windows Server Deployment ProposalOverviewEach student will .docx
Windows Server Deployment ProposalOverviewEach student will .docxWindows Server Deployment ProposalOverviewEach student will .docx
Windows Server Deployment ProposalOverviewEach student will .docxalanfhall8953
 
Wireshark Lab TCP v6.0 Supplement to Computer Networking.docx
Wireshark Lab TCP v6.0  Supplement to Computer Networking.docxWireshark Lab TCP v6.0  Supplement to Computer Networking.docx
Wireshark Lab TCP v6.0 Supplement to Computer Networking.docxalanfhall8953
 
Wireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docx
Wireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docxWireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docx
Wireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docxalanfhall8953
 
Wireshark Lab IP v6.0 Supplement to Computer Networking.docx
Wireshark Lab IP v6.0  Supplement to Computer Networking.docxWireshark Lab IP v6.0  Supplement to Computer Networking.docx
Wireshark Lab IP v6.0 Supplement to Computer Networking.docxalanfhall8953
 
Willowbrook SchoolBackgroundWillowbrook School is a small, pri.docx
Willowbrook SchoolBackgroundWillowbrook School is a small, pri.docxWillowbrook SchoolBackgroundWillowbrook School is a small, pri.docx
Willowbrook SchoolBackgroundWillowbrook School is a small, pri.docxalanfhall8953
 
Wind PowerUsed For Millennia Variations in alb.docx
Wind PowerUsed For Millennia Variations in alb.docxWind PowerUsed For Millennia Variations in alb.docx
Wind PowerUsed For Millennia Variations in alb.docxalanfhall8953
 
winter 2013 235 CREATE A CONTRACTInstructionsI will giv.docx
winter 2013 235 CREATE A CONTRACTInstructionsI will giv.docxwinter 2013 235 CREATE A CONTRACTInstructionsI will giv.docx
winter 2013 235 CREATE A CONTRACTInstructionsI will giv.docxalanfhall8953
 
WinEst As 1. Es2. Tassignment stInfo (Esti.docx
WinEst As 1. Es2. Tassignment stInfo (Esti.docxWinEst As 1. Es2. Tassignment stInfo (Esti.docx
WinEst As 1. Es2. Tassignment stInfo (Esti.docxalanfhall8953
 
Wiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docx
Wiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docxWiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docx
Wiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docxalanfhall8953
 
Winter 2011 • Morality in Education 35Workplace Bullying .docx
Winter 2011 • Morality in Education 35Workplace Bullying .docxWinter 2011 • Morality in Education 35Workplace Bullying .docx
Winter 2011 • Morality in Education 35Workplace Bullying .docxalanfhall8953
 
With the competitive advantage that Crocs’ supply chain holds, the.docx
With the competitive advantage that Crocs’ supply chain holds, the.docxWith the competitive advantage that Crocs’ supply chain holds, the.docx
With the competitive advantage that Crocs’ supply chain holds, the.docxalanfhall8953
 
Windows Server 2012 R2 Essentials Windows Server 2012.docx
Windows Server 2012 R2 Essentials  Windows Server 2012.docxWindows Server 2012 R2 Essentials  Windows Server 2012.docx
Windows Server 2012 R2 Essentials Windows Server 2012.docxalanfhall8953
 
Wind power resources on the eastern U.S. continental shelf are est.docx
Wind power resources on the eastern U.S. continental shelf are est.docxWind power resources on the eastern U.S. continental shelf are est.docx
Wind power resources on the eastern U.S. continental shelf are est.docxalanfhall8953
 
WilliamStearman_Java301build.xml Builds, tests, and ru.docx
WilliamStearman_Java301build.xml      Builds, tests, and ru.docxWilliamStearman_Java301build.xml      Builds, tests, and ru.docx
WilliamStearman_Java301build.xml Builds, tests, and ru.docxalanfhall8953
 
Wilco Corporation has the following account balances at December 3.docx
Wilco Corporation has the following account balances at December 3.docxWilco Corporation has the following account balances at December 3.docx
Wilco Corporation has the following account balances at December 3.docxalanfhall8953
 
Wilson Majee Technology Diffusion, S-Curve, and Innovation.docx
Wilson Majee Technology Diffusion, S-Curve, and Innovation.docxWilson Majee Technology Diffusion, S-Curve, and Innovation.docx
Wilson Majee Technology Diffusion, S-Curve, and Innovation.docxalanfhall8953
 
WinARM - Simulating Advanced RISC Machine Architecture .docx
WinARM - Simulating Advanced RISC Machine Architecture   .docxWinARM - Simulating Advanced RISC Machine Architecture   .docx
WinARM - Simulating Advanced RISC Machine Architecture .docxalanfhall8953
 
William PennWhat religion was William PennWilliam Pen was fr.docx
William PennWhat religion was William PennWilliam Pen was fr.docxWilliam PennWhat religion was William PennWilliam Pen was fr.docx
William PennWhat religion was William PennWilliam Pen was fr.docxalanfhall8953
 

More from alanfhall8953 (20)

With regards to this article, I agree and disagree on certain leve.docx
With regards to this article, I agree and disagree on certain leve.docxWith regards to this article, I agree and disagree on certain leve.docx
With regards to this article, I agree and disagree on certain leve.docx
 
WIT Financial Accounting Test Ch.docx
WIT                   Financial Accounting Test                 Ch.docxWIT                   Financial Accounting Test                 Ch.docx
WIT Financial Accounting Test Ch.docx
 
Windows Server Deployment ProposalOverviewEach student will .docx
Windows Server Deployment ProposalOverviewEach student will .docxWindows Server Deployment ProposalOverviewEach student will .docx
Windows Server Deployment ProposalOverviewEach student will .docx
 
Wireshark Lab TCP v6.0 Supplement to Computer Networking.docx
Wireshark Lab TCP v6.0  Supplement to Computer Networking.docxWireshark Lab TCP v6.0  Supplement to Computer Networking.docx
Wireshark Lab TCP v6.0 Supplement to Computer Networking.docx
 
Wireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docx
Wireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docxWireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docx
Wireshark Lab IP v6.0Supplement to Computer Networking A Top-D.docx
 
Wireshark Lab IP v6.0 Supplement to Computer Networking.docx
Wireshark Lab IP v6.0  Supplement to Computer Networking.docxWireshark Lab IP v6.0  Supplement to Computer Networking.docx
Wireshark Lab IP v6.0 Supplement to Computer Networking.docx
 
Willowbrook SchoolBackgroundWillowbrook School is a small, pri.docx
Willowbrook SchoolBackgroundWillowbrook School is a small, pri.docxWillowbrook SchoolBackgroundWillowbrook School is a small, pri.docx
Willowbrook SchoolBackgroundWillowbrook School is a small, pri.docx
 
Wind PowerUsed For Millennia Variations in alb.docx
Wind PowerUsed For Millennia Variations in alb.docxWind PowerUsed For Millennia Variations in alb.docx
Wind PowerUsed For Millennia Variations in alb.docx
 
winter 2013 235 CREATE A CONTRACTInstructionsI will giv.docx
winter 2013 235 CREATE A CONTRACTInstructionsI will giv.docxwinter 2013 235 CREATE A CONTRACTInstructionsI will giv.docx
winter 2013 235 CREATE A CONTRACTInstructionsI will giv.docx
 
WinEst As 1. Es2. Tassignment stInfo (Esti.docx
WinEst As 1. Es2. Tassignment stInfo (Esti.docxWinEst As 1. Es2. Tassignment stInfo (Esti.docx
WinEst As 1. Es2. Tassignment stInfo (Esti.docx
 
Wiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docx
Wiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docxWiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docx
Wiley Plus Brief Exercise 6 –Accounting 100Brief Exercise 6-1B.docx
 
Winter 2011 • Morality in Education 35Workplace Bullying .docx
Winter 2011 • Morality in Education 35Workplace Bullying .docxWinter 2011 • Morality in Education 35Workplace Bullying .docx
Winter 2011 • Morality in Education 35Workplace Bullying .docx
 
With the competitive advantage that Crocs’ supply chain holds, the.docx
With the competitive advantage that Crocs’ supply chain holds, the.docxWith the competitive advantage that Crocs’ supply chain holds, the.docx
With the competitive advantage that Crocs’ supply chain holds, the.docx
 
Windows Server 2012 R2 Essentials Windows Server 2012.docx
Windows Server 2012 R2 Essentials  Windows Server 2012.docxWindows Server 2012 R2 Essentials  Windows Server 2012.docx
Windows Server 2012 R2 Essentials Windows Server 2012.docx
 
Wind power resources on the eastern U.S. continental shelf are est.docx
Wind power resources on the eastern U.S. continental shelf are est.docxWind power resources on the eastern U.S. continental shelf are est.docx
Wind power resources on the eastern U.S. continental shelf are est.docx
 
WilliamStearman_Java301build.xml Builds, tests, and ru.docx
WilliamStearman_Java301build.xml      Builds, tests, and ru.docxWilliamStearman_Java301build.xml      Builds, tests, and ru.docx
WilliamStearman_Java301build.xml Builds, tests, and ru.docx
 
Wilco Corporation has the following account balances at December 3.docx
Wilco Corporation has the following account balances at December 3.docxWilco Corporation has the following account balances at December 3.docx
Wilco Corporation has the following account balances at December 3.docx
 
Wilson Majee Technology Diffusion, S-Curve, and Innovation.docx
Wilson Majee Technology Diffusion, S-Curve, and Innovation.docxWilson Majee Technology Diffusion, S-Curve, and Innovation.docx
Wilson Majee Technology Diffusion, S-Curve, and Innovation.docx
 
WinARM - Simulating Advanced RISC Machine Architecture .docx
WinARM - Simulating Advanced RISC Machine Architecture   .docxWinARM - Simulating Advanced RISC Machine Architecture   .docx
WinARM - Simulating Advanced RISC Machine Architecture .docx
 
William PennWhat religion was William PennWilliam Pen was fr.docx
William PennWhat religion was William PennWilliam Pen was fr.docxWilliam PennWhat religion was William PennWilliam Pen was fr.docx
William PennWhat religion was William PennWilliam Pen was fr.docx
 

Recently uploaded

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxJiesonDelaCerna
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 

Recently uploaded (20)

18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
CELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptxCELL CYCLE Division Science 8 quarter IV.pptx
CELL CYCLE Division Science 8 quarter IV.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 

Create Dynamic Car Objects

  • 1. window.onload = createCarObject; function createCarObject() { var make = document.getElementById("carsMake").value; var model = document.getElementById("carsModel").value; var year = document.getElementById("carsYear").value; document.getElementById("carsMake").innerHTML = make; document.getElementById("carsModel").innerHTML = model; document.getElementById("carsYear").innerHTML = year; var newCar = new Car(make, model, year); newCar.speed();
  • 2. newCar.drive(); newCar.cruise(); } function updateDocument() { this.make = document.getElementById("carsMake").value; this.model = document.getElementById("carsModel").value; this.year = document.getElementById("carsYear").value; document.getElementById("CarsMake").innerHTML = this.make; document.getElementById("CarsModel").innerHTML = this.model; document.getElementById("CarsYear").innerHTML = this.year; this.speeding = document.getElementById("speed").checked;
  • 3. this.driving = document.getElementById("drive").checked; this.cruising = document.getElementById("cruise").checked; if (this.year >= 2000 && this.speeding) { document.getElementById("speeding").innerHTML = " Yes, " + this.name + " says Nice set of wheels man! "; } else if (this.speeding) { document.getElementById("speeding").innerHTML = " Yes, " + this.name + " Yes, it's Purring?! "; } else { document.getElementById("speeding").innerHTML = " No, " + this.name + " No, it's Resting. "; } if (this.driving) { document.getElementById("driving").innerHTML = "Yes, " + this.name + " I'm a Low Rider!"; } else {
  • 4. document.getElementById("driving").innerHTML = "No, " + this.name + " Getting to work!"; } if (this.cruising) { document.getElementById("cruising").innerHTML = "Yes, " + this.name + "I'm a Racer"; } else { document.getElementById("cruising").innerHTML = "No, " + this.name + "Radar Trap Ahead!"; } } function Car(make, model, year) { this.make = make; this.model = model; this.year = year; Car.prototype.speeding = document.getElementById("speed").checked;
  • 5. Car.prototype.driving = document.getElementById("drive").checked; Car.prototype.cruising = document.getElementById("cruise").checked; Car.prototype.speed = function() { if (this.speed >= 2000 && this.speeding) { document.getElementById("speeding").innerHTML = " Yes, " + this.name + " Yes, it's Purring! "; } else if (this.speeding) { document.getElementById("speeding").innerHTML = " Yes, " + this.name + " No, it's resting! "; } else { document.getElementById("speeding").innerHTML = " No, " + this.name + " is being very quiet. "; }
  • 6. }; Car.prototype.drive = function() { if (this.sitting) { document.getElementById("driving").innerHTML = "Yes, " + this.name + " I'm a Low Rider!"; } else { document.getElementById("driving").innerHTML = "No, " + this.name + " Getting to work!"; } }; Car.prototype.cruise = function() { if (this.cruising) { document.getElementById("cruising").innerHTML = "Yes, " + this.name + "I'm a Racer!"; } else { document.getElementById("cruising").innerHTML = "No,
  • 7. " + this.name + "Radar Trap Ahead!"; } }; } This page requires JavaScriptEM228 - Scripting for the Web with JavaScript Creating Dynamic Car Objects Lab Enter the Car's Make, Model and Year below: Make: Model: Year: Car is Running Car is Cruising Car is Speeding The Car's MakeThe Car's ModelThe Car's YearIs the car Running?Is the car Cruising?Is the car Speeding? h1, h2, h3, div {
  • 8. text-align: center; } body { background-color: white; color: #A90232; } table { border: #A90232; } th { text-align: center; font-weight: bold; color: black; }
  • 9. td { text-align: center; font-weight: bold; } EM228 Requirements You will use the DynamicDogObject’s HTML/JS/CSS files as templates - in order to create a set of new DynamicCarObject’s HTML/JS/CSS files. CSS: Copy DogObject.css from Class Content - the one we used for dynamic dog. Make the modifications (if necessary) so the ids/classes work with the new DynamicCarObject.html and DynamicCarObject.js code that you will create. HTML: Copy DynamicDogObject.html as a Template to make these Modifications: 1. Create the Banner to say “Creating Dynamic Car Objects” 2. below the banner say “Enter the Car’s Make, Model and Year 3. rename the labels for the textboxes appropriately 4. label the checkboxes as Car is running - Car is Cruising - Car is Speeding
  • 10. 5. rename the table elements appropriately a. For the textbox answers: i. The Car’s Make is <make> ii. The Car’s Model is <model> iii. The Car’s Year is: 1. if < 2000 “Seriously Dude?” 2. if >= 2000 “Nice Set of Wheels Man!” b. For the checkbox answers: i. checked = “Yes, it’s Purring” unchecked = “No, it’s Resting” ii. checked = “I’m a Low Rider” unchecked = “Getting to Work” iii. checked = “I’m a Racer” unchecked = “Radar Trap Ahead” JS: Copy DynamicDogObject.js as a Template & make Necessary Modifications Upload to the ClassWeb for me to check there and submit to the portal as well