0% found this document useful (0 votes)
13 views3 pages

Practicle No 8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views3 pages

Practicle No 8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Practicle no 8

<!DOCTYPE html>

<html lang="en">

<head>

<title>Document</title>

</head>

<style>

form{

width: 600px;

border: 2px solid black;

padding: 15px;

background-color: rgb(231, 214, 131);

</style>

<body>

<form action="#">

<h1>Pizza Corner</h1>

<h2>Pizza Order Form</h2>

Customer name : <input type="text" id="cname"> Telephone : <input type="text" id="tele"><br><br>

Email Adress : <input type="email" id email><br><br>

Delivery Adress : <textarea name="ta" id="ta"></textarea><br><br>

<h2>Pizza Type</h2>

<select name="select" id="sel">

<option value="300">Cheese and Corn - ₹300</option>

<option value="350">Margherita - ₹350</option>

<option value="400">Pepperoni - ₹400</option>

</select>

<h2>Pizza Size</h2>

<input type="radio" name="size" value="00" checked>Small

<input type="radio" name="size" value="20"> Medium (Rs.20 Extra)

<input type="radio" name="size" value="50">Large (Rs.50 Extra)

<h2>Pizza Toppings</h2>
<input type="checkbox" name="check" value="50"> Extra Cheese (Rs.50)

<input type="checkbox" name="check" value="20">

Onion (Rs.20)

<input type="checkbox" name="check" value="30">

Mashroom (Rs.30) <br><br>

Quantity <input type="number" id="quan"><br><br>

<button type="button" onclick="calculate()">Calculate Bill</button>

<button type="reset">Clear</button><br><br>

Total bill : <input type="text" name="bill" id="total" readonly>

</form>

<script>

function calculate() {

var price = parseInt(document.getElementById("sel").value)

var sizePrice = parseInt(document.querySelector('input[name="size"]:checked').value);

var qnt=parseInt(document.getElementById("quan").value);

var toppingCost = 0;

var toppings = document.querySelectorAll('input[name="check"]:checked');

toppings.forEach(function(topping) {

toppingCost += parseInt(topping.value);

});

var total = (price + sizePrice + toppingCost) * qnt;

document.getElementById("total").value= "₹" + total;

</script>

</body>

</html>

You might also like