Putting Arrays to Work
Time to build another mini web app. We’ll let the user enter a comma-separated list of orders in an input field, then we’ll calculate and display the price for each order, the total number of shirts, and the total price.
Here’s the HTML:
| <!DOCTYPE html> |
| <html> |
| <head> |
| <title>Shirt Price Calculator</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| <style type="text/css"> |
| .right {text-align: right;} |
| .center {text-align: center;} |
| th, td {border: 1px solid gray; padding: 3px} |
| </style> |
| </head> |
| |
| <body> |
| <h1>Shirt Price Calculator</h1> |
| |
| <p> |
| Enter list of orders separated by commas: |
| </p> |
| |
| <p> |
| <input type="text" size="40" id= ... |
Get Web Development with ReasonML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.