Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

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
expand button
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>
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education