Last active
April 26, 2020 19:49
-
-
Save caritosteph/54d9ad9113e34e695ca9a3b2490588b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8" /> | |
<title>Lesson 8 - Loops</title> | |
</head> | |
<body> | |
<div> | |
<h3>List of Products</h3> | |
<div> | |
<span>Iphone</span><br /> | |
<span>Price: 900 €</span> | |
<input | |
for="2" | |
type="button" | |
id="addPhoneToCart" | |
value="Add to shopping cart" | |
/> | |
</div> | |
<br /> | |
<div> | |
<span>Nintendo DS</span><br /> | |
<span>Price: 1200 €</span> | |
<input | |
type="button" | |
id="addNintendoToCart" | |
value="Add to shopping car" | |
/> | |
</div> | |
<br /> | |
<div> | |
<span>MacBook Air</span><br /> | |
<span>Price: 3200 €</span> | |
<input | |
type="button" | |
id="addMackbookToCart" | |
value="Add to shopping car" | |
/> | |
</div> | |
</div> | |
<hr /> | |
<div> | |
<h3>Shopping Cart</h3> | |
<input | |
type="button" | |
id="showShoppingCart" | |
value="Show Shopping Cart Products" | |
/> | |
<div id="shoppingCart"> | |
<!-- Display shopping cart products--> | |
</div> | |
<h3> | |
Total Price | |
</h3> | |
<span id="total"> | |
<!-- show total price--> | |
</span> | |
<input type="button" id="totalPrice" value="Show total price" /> | |
</div> | |
<script> | |
/* | |
* Shopping Cart | |
* Product: | |
* name: 'Iphone' | |
* price: 900 | |
*/ | |
/* | |
* Get button's element | |
*/ | |
//add your code here | |
/* | |
* create a shoppingCart variable to store each product object that you add to your shopping store. | |
*/ | |
// Add you code here | |
/* | |
* Add products to your shoppingCart store and update the quantity. | |
*/ | |
function addIphoneToShoppingCart() { | |
// add your code here | |
} | |
function addNintendoToShoppingCart() { | |
// add your code here | |
} | |
function addMackbookToShoppingCart() { | |
// add your code here | |
} | |
/* | |
* showShoppingCartProducts: Display the list of products when the user clicks on "Show shopping cart list" button. | |
*/ | |
function showShoppingCartProducts() { | |
// add your code here | |
} | |
/* | |
* BONUS | |
* showTotalPrice: Display the total price when the user clicks on "Show total Price" product. | |
*/ | |
function showTotalPrice() { | |
// add your code here | |
} | |
/* | |
* add Event Listener here | |
*/ | |
</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment