37 lines
1.5 KiB
HTML
37 lines
1.5 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<!--
|
||
|
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||
|
Click nbfs://nbhost/SystemFileSystem/Templates/Other/html.html to edit this template
|
||
|
-->
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Table Generator</title>
|
||
|
<meta charset="UTF-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
<script>
|
||
|
document.write("<table>");
|
||
|
// Write table header
|
||
|
document.write("<tr><th>Trip Name</th><th>Miles Driven</th><th>Gallons Used</th><th>Miles Per Gallon</th></tr>");
|
||
|
do {
|
||
|
var tripName = prompt("Enter data for Trip Name collum");
|
||
|
var milesDriven = prompt("Enter data for Miles driven collum");
|
||
|
var gallonsUsed = prompt("Enter data for Gallons used collum");
|
||
|
var mpg = prompt("Enter data for Miles Per Gallon collum");
|
||
|
document.write("<tr>");
|
||
|
document.write("<td>" + tripName + "</td>");
|
||
|
document.write("<td>" + milesDriven + " Mi. </td>");
|
||
|
document.write("<td>" + gallonsUsed + " gallons</td>");
|
||
|
document.write("<td>" + mpg + " MPG</td>");
|
||
|
document.write("</tr>");
|
||
|
var iterate = prompt("add more data? (Type true/false)");
|
||
|
} while (iterate === "true");
|
||
|
document.write("</table>");
|
||
|
</script>
|
||
|
<style>
|
||
|
table, th, td {
|
||
|
border: 1px solid;
|
||
|
}
|
||
|
</style>
|
||
|
</head>
|
||
|
</html>
|