The document defines functions to create a dynamic car object based on user input. It defines functions to get the make, model, and year values from form elements on the page. It then defines a Car constructor function that takes those values as parameters and sets properties. Methods are defined on the Car prototype to update the page based on property values and checkbox selections, providing responses related to the car's speed, driving, and cruising.
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();
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 {
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