Write a JavaScript Program to achieve the following requirements from the provided webpage codes. An expected output has been provided for you. The user can select the type of pizza from the “Select a pizza” dropdown list. The user can enter the pizza quantity in the “Pizza Quantity” field. After the user clicks the “Add Pizza” button, the page will show the Pizza list and the quantity of each. Afterward, the selection of the “Select a pizza” dropdown list will go back to  “-----”  and the quantity in the  “Pizza Quantity”  field will go back to “0” After the user clicks the “Calculate Total Cost” button, the page will show the total cost of the order and start with the message “Total bill of the order is - ”. Add JavaScript event in the HTML file where necessary.       Pizzas Ordering Form    Simply select your pizza and enter quantity to calculate total order cost                      Select a pizza                                                                                                                          Pizza Quantity

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
icon
Related questions
Question

Write a JavaScript Program to achieve the following requirements from the provided webpage codes. An expected output has been provided for you.

  1. The user can select the type of pizza from the “Select a pizza” dropdown list.
  2. The user can enter the pizza quantity in the “Pizza Quantity” field.
  3. After the user clicks the “Add Pizza” button, the page will show the Pizza list and the quantity of each. Afterward, the selection of the “Select a pizza” dropdown list will go back to  “-----”  and the quantity in the  “Pizza Quantity”  field will go back to “0
  4. After the user clicks the “Calculate Total Cost” button, the page will show the total cost of the order and start with the message “Total bill of the order is - ”.

Add JavaScript event in the HTML file where necessary.

<!DOCTYPE html>

<html>

  <body>

    <h1>Pizzas Ordering Form</h1>

   <p> Simply select your pizza and enter quantity to calculate total order cost </p>

   <form id="orderForm">
       <p>
           <label for="pizza_list">Select a pizza</label>
           <select name="pizza_list " id="pizza_list">
               <option value="---" selected id="empty">-----</option>
               <option value="10" name="Margherita">Margherita ($10 each)</option>
               <option value="12" name="Pepperoni">Pepperoni ($12 each)</option>           
               <option value="15" name="Supreme">Supreme ($15 each)</option>
           </select>
        </p>

       <p>
           <label for="pizza_quantity">Pizza Quantity</label>
           <input type="text" name="pizza_quantity" value="0" id="pizza_quantity">
        </p>

       <p> <input type="button" value="Add Pizza" id="add_pizza"> </p>    

        <p> <input type="button" value="Calculate Total Cost" id="total_cost"> </p>

    </form>

    <p><ul id="ulList"></ul></p>

    <div id="message"></div>

   <script>
         
// Your code goes here

    </script>

</body>

</html>

Pizzas Ordering Form
Simply select your pizza and enter quantity to calculate total order cost!
Select a pizza
Pizza Quantity 0
Add Pizza
Calculate Total Cost
Margherita ($10 each) : 2
Supreme ($15 each) : 3
Supreme ($15 each) : 1
●
Total bill of the order is - $80.00
Transcribed Image Text:Pizzas Ordering Form Simply select your pizza and enter quantity to calculate total order cost! Select a pizza Pizza Quantity 0 Add Pizza Calculate Total Cost Margherita ($10 each) : 2 Supreme ($15 each) : 3 Supreme ($15 each) : 1 ● Total bill of the order is - $80.00
<!DOCTYPE html>
<html>
<body>
<h1>Pizzas Ordering Form</h1>
<p> Simply select your pizza and enter quantity to calculate total order cost </p>
<form id="orderForm">
<p>
<label for="pizza_list">Select a pizza</label>
<select name="pizza_list
id="pizza_list">
<option value="---" selected id="empty">-----</option>
<option value="10" name="Margherita">Margherita ($10 each)</option>
<option value="12" name="Pepperoni" >Pepperoni ($12 each)</option>
<option value="15" name="Supreme">Supreme ($15 each) </option>
</select>
</p>
<p>
<label for="pizza_quantity">Pizza Quantity</label>
<input type="text" name="pizza_quantity" value="0" id="pizza_quantity">
</p>
<p> <input type="button" value="Add Pizza" id="add_pizza"> </p>
<p> <input type="button" value="Calculate Total Cost" id="total_cost"> </p>
</form>
<p><ul id="ulList"></ul></p>
<div id="message"></div>
<script>
// Your code goes here
</script>
</body>
</html>
Transcribed Image Text:<!DOCTYPE html> <html> <body> <h1>Pizzas Ordering Form</h1> <p> Simply select your pizza and enter quantity to calculate total order cost </p> <form id="orderForm"> <p> <label for="pizza_list">Select a pizza</label> <select name="pizza_list id="pizza_list"> <option value="---" selected id="empty">-----</option> <option value="10" name="Margherita">Margherita ($10 each)</option> <option value="12" name="Pepperoni" >Pepperoni ($12 each)</option> <option value="15" name="Supreme">Supreme ($15 each) </option> </select> </p> <p> <label for="pizza_quantity">Pizza Quantity</label> <input type="text" name="pizza_quantity" value="0" id="pizza_quantity"> </p> <p> <input type="button" value="Add Pizza" id="add_pizza"> </p> <p> <input type="button" value="Calculate Total Cost" id="total_cost"> </p> </form> <p><ul id="ulList"></ul></p> <div id="message"></div> <script> // Your code goes here </script> </body> </html>
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 10 images

Blurred answer
Knowledge Booster
Fundamentals of JavaScript
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.
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education