0% found this document useful (0 votes)
5 views2 pages

Lakshmi Grocery Store

The document is an HTML representation of the Lakshmi Grocery Store, showcasing a list of products with their prices and an 'Add to Cart' button for each item. It includes a shopping cart section that dynamically updates the total price as items are added. A JavaScript function manages the cart functionality and displays the total cost of selected items.

Uploaded by

edison45264
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)
5 views2 pages

Lakshmi Grocery Store

The document is an HTML representation of the Lakshmi Grocery Store, showcasing a list of products with their prices and an 'Add to Cart' button for each item. It includes a shopping cart section that dynamically updates the total price as items are added. A JavaScript function manages the cart functionality and displays the total cost of selected items.

Uploaded by

edison45264
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/ 2

<html>

<head>
<title>Lakshmi Grocery Store</title>
</head>
<body>

<h1>Lakshmi Grocery Store</h1>

<h2>Products</h2>

<div>
<p>Apples - $1.50 <button onclick="addToCart('Apples',
1.5)">Add to Cart</button></p>
<p>Bananas - $0.99 <button onclick="addToCart('Bananas',
0.99)">Add to Cart</button></p>
<p>Milk - $2.00 <button onclick="addToCart('Milk', 2.0)">Add to
Cart</button></p>
<p>Bread - $1.80 <button onclick="addToCart('Bread',
1.8)">Add to Cart</button></p>
</div>

<h2>Shopping Cart</h2>
<ul id="cartItems"></ul>
<p>Total: $<span id="total">0.00</span></p>

<script>
var total = 0;
function addToCart(product, price) {
var cartList = document.getElementById("cartItems");
var item = document.createElement("li");
item.textContent = product + " - $" + price.toFixed(2);
cartList.appendChild(item);

total += price;
document.getElementById("total").textContent =
total.toFixed(2);
}
</script>

</body>
</html>

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy