Error code
ERRW:0.9:K0.9
Were you logged in?
Yes
Your username (if logged in)
No response
Your HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Watch Store</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h2>WATCH STORE</h2>
<div>
<a href="#">Home</a>
<a href="#products">Products</a>
🛒 <span id="cart-count">0</span>
</div>
</header>
<section class="banner">
<h1>Luxury Watches</h1>
<button onclick="scrollToProducts()">Shop Now</button>
</section>
<section class="products" id="products">
<h2>Products</h2>
<div class="product">
<h3>Classic Watch</h3>
<p>$120</p>
<button onclick="addToCart('Classic Watch',120)">Buy</button>
</div>
<div class="product">
<h3>Sport Watch</h3>
<p>$200</p>
<button onclick="addToCart('Sport Watch',200)">Buy</button>
</div>
</section>
<div class="cart-box">
<h3>Cart</h3>
<div id="cart-items"></div>
<p>Total: $<span id="total">0</span></p>
</div>
<script src="script.js"></script>
</body>
</html>
Your JavaScript
let cart = [];
let total = 0;
function addToCart(name, price) {
cart.push({name, price});
total += price;
updateCart();
}
function updateCart() {
document.getElementById("cart-count").innerText = cart.length;
document.getElementById("total").innerText = total;
let list = document.getElementById("cart-items");
list.innerHTML = "";
cart.forEach(item => {
list.innerHTML += item.name + " - $" + item.price + "<br>";
});
}
function scrollToProducts() {
document.getElementById("products").scrollIntoView({
behavior: "smooth"
});
}
Your CSS
body {
font-family: Arial;
margin: 0;
background: #f5f5f5;
}
header {
background: black;
color: white;
padding: 10px;
display: flex;
justify-content: space-between;
}
.banner {
background: gray;
color: white;
text-align: center;
padding: 100px;
}
.products {
padding: 20px;
}
.product {
background: white;
padding: 15px;
margin: 10px;
}
button {
background: black;
color: white;
padding: 8px;
border: none;
}
button:hover {
background: gold;
color: black;
}
.cart-box {
position: fixed;
right: 10px;
bottom: 10px;
background: white;
padding: 10px;
}
Error code
ERRW:0.9:K0.9
Were you logged in?
Yes
Your username (if logged in)
No response
Your HTML
Your JavaScript
Your CSS