We want to be able to have JavaScript generate HTML items. In this program, when a button is clicked a function is called that generates an html table of miles per hour values and their equivalent kilometers per hour values on the page. The table should be inserted in an HTML divison. Use the array of mph values given below. You cannot modify this array. The kph values should be rounded to 1 decimal place. var mph = [20, 35, 45, 55, 65, 70, 75, 80, 90]; The HTML table must be generated using a JavaScript loop and the array give above. The table is displayed only after a button is pressed. Examples of this kind of thing are given in the Lecture notes for the week discussing loops and arrays. Once the button is clicked, the table on the page should look like the following (more or less, the exact style is not important), with the list of 9 mph values given on the left, and all 9 equivalent kph values displayed in the right column. You may style your table, or leave it very plain-- either way is OK. Miles per Hr. Kilometers per Hr. 20 35 45 55 65 70 75 80 90 32.2 56.3 72.4 88.5 104.6 ...and so on... ...and so on... ...and so on... ...and so on... The formula that converts from mph to kph is given here: kph = mph * 1.609 Round your conversions to 1 decimal place. Use the toFixed() method.
We want to be able to have JavaScript generate HTML items. In this program, when a button is clicked a function is called that generates an html table of miles per hour values and their equivalent kilometers per hour values on the page. The table should be inserted in an HTML divison. Use the array of mph values given below. You cannot modify this array. The kph values should be rounded to 1 decimal place. var mph = [20, 35, 45, 55, 65, 70, 75, 80, 90]; The HTML table must be generated using a JavaScript loop and the array give above. The table is displayed only after a button is pressed. Examples of this kind of thing are given in the Lecture notes for the week discussing loops and arrays. Once the button is clicked, the table on the page should look like the following (more or less, the exact style is not important), with the list of 9 mph values given on the left, and all 9 equivalent kph values displayed in the right column. You may style your table, or leave it very plain-- either way is OK. Miles per Hr. Kilometers per Hr. 20 35 45 55 65 70 75 80 90 32.2 56.3 72.4 88.5 104.6 ...and so on... ...and so on... ...and so on... ...and so on... The formula that converts from mph to kph is given here: kph = mph * 1.609 Round your conversions to 1 decimal place. Use the toFixed() method.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
100%
Hello, I am in need of some assistance on an assignment, & would like some guidance as to what I should do!
It's a simple JavaScript program, I wish to create a HTML table, using proper tags for table, rows, & data, to make a conversion between MPH to KPH with a single press of a button.
The two images show the data for the loops & arrays, & what the intended outcome is, I am just unsure of how to create the table & have it display the conversion via a button click.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 4 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education