Untitled
unknown
plain_text
2 years ago
2.5 kB
7
Indexable
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dropshipping Store</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f4f4f4;
}
header {
background-color: #333;
color: white;
text-align: center;
padding: 1em;
}
section {
margin: 20px;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
}
.product {
border: 1px solid #ddd;
padding: 10px;
margin: 10px;
max-width: 300px;
text-align: center;
background-color: white;
}
form {
max-width: 300px;
margin: 20px;
padding: 10px;
background-color: #fff;
border: 1px solid #ddd;
}
</style>
</head>
<body>
<header>
<h1>Dropshipping Store</h1>
</header>
<section>
<div class="product">
<h2>Product 1</h2>
<p>Description of Product 1.</p>
<p>Price: $50</p>
<button onclick="addToCart('Product 1', 50)">Add to Cart</button>
</div>
<div class="product">
<h2>Product 2</h2>
<p>Description of Product 2.</p>
<p>Price: $40</p>
<button onclick="addToCart('Product 2', 40)">Add to Cart</button>
</div>
</section>
<form id="orderForm">
<h2>Order Summary</h2>
<ul id="cartItems"></ul>
<label for="customerName">Name:</label>
<input type="text" id="customerName" required>
<label for="customerEmail">Email:</label>
<input type="email" id="customerEmail" required>
<button type="submit" onclick="submitOrder()">Place Order</button>
</form>
<script>
let cart = [];
function addToCart(product, price) {
cart.push({ product, price });
updateCart();
}
function updateCart() {
const cartItems = document.getElementById("cartItems");
cartItems.innerHTML = "";
cart.forEach(item => {
const li = document.createElement("li");
li.textContent = `${item.product} - $${item.price}`;
cartItems.appendChild(li);
});
}
function submitOrder() {
const customerName = document.getElementById("customerName").value;
const customerEmail = document.getElementById("customerEmail").value;
// In a real scenario, you would send this information to a server for processing
console.log("Order submitted:", { customerName, customerEmail, cart });
}
</script>
</body>
</html>
Editor is loading...
Leave a Comment