JustPaste
HomeCategoriesAboutDonateContactTerms of UsePrivacy Policy
JustPaste

Free online notepad — write and share instantly

Navigate

  • Home
  • Timeline
  • Categories

Info

  • About
  • Donate
  • Contact

Legal

  • Terms of Use
  • Privacy Policy

© 2026 JustPaste.app. All rights reserved.

Made with ♥ by JustPaste

Untitled Page | JustPaste.app
about 1 hour ago3 views
👨‍💻Programming

Untitled Page

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Registration and Products Catalog</title>

    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            background-color: #5255f8;
        }

        header {
            background-color: #173b70;
            color: white;
            padding: 20px;
            text-align: center;
        }

        nav {
            background-color: #765;
            padding: 12px;
            text-align: center;
        }

        nav a {
            color: white;
            text-decoration: none;
            margin: 15px;
        }

        section {
            background-color: pink;
            margin: 25px auto;
            padding: 20px;
            max-width: 900px;
            border-radius: 10px;
        }

        input {
            display: block;
            width: 95%;
            padding: 10px;
            margin: 10px 0;
            border: 1px solid #ccc;
            border-radius: 5px;
        }

        button {
            background-color: #1769aa;
            color: white;
            padding: 10px 15px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
        }

        button:hover {
            background-color: #104778;
        }

        .products {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
            gap: 20px;
        }

        .product {
            background-color: #f8faff;
            border: 1px solid #ddd;
            padding: 18px;
            text-align: center;
            border-radius: 8px;
        }

        .product h3 {
            color: #173b70;
        }

        .message {
            color: green;
            font-weight: bold;
        }

        footer {
            background-color: #173b70;
            color: white;
            text-align: center;
            padding: 15px;
        }
    </style>
</head>

<body>

<header>
    <h1>My Shopping Website</h1>
    <p>Register and Explore Our Products</p>
</header>

<nav>
    <a href="#registration">Registration</a>
    <a href="#catalog">Products Catalog</a>
    <a href="#cart">Cart (<span id="cartCount">0</span>)</a>
</nav>

<section id="registration">
    <h2>User Registration</h2>

    <form id="registrationForm">
        <input type="text" id="name" placeholder="Enter your full name" required>
        <input type="email" id="email" placeholder="Enter your email" required>
        <input type="password" id="password" placeholder="Enter password (minimum 6 characters)" minlength="6" required>
        <button type="submit">Register</button>
    </form>

    <p id="registerMessage" class="message"></p>
</section>

<section id="catalog">
    <h2>Products Catalog</h2>

    <div class="products">
        <div class="product">
            <h3>Product 1</h3>
            <p>Wireless Headphones</p>
            <p>Price: ₹999</p>
            <button onclick="addToCart('Wireless Headphones', 999)">Add to Cart</button>
        </div>

        <div class="product">
            <h3>Product 2</h3>
            <p>Smart Watch</p>
            <p>Price: ₹1499</p>
            <button onclick="addToCart('Smart Watch', 1499)">Add to Cart</button>
        </div>
    </div>
</section>

<section id="cart">
    <h2>Shopping Cart</h2>

    <ul id="cartItems"></ul>

    <h3>Total: ₹<span id="total">0</span></h3>

    <button onclick="clearCart()">Clear Cart</button>
</section>

<footer>
    <p>© 2026 My Shopping Website</p>
</footer>

<script>
    // Registration form validation
    document.getElementById("registrationForm")
        .addEventListener("submit", function(event) {
            event.preventDefault();

            let name = document.getElementById("name").value.trim();
            let email = document.getElementById("email").value.trim();
            let password = document.getElementById("password").value;

            if (name === "" || email === "" || password.length < 6) {
                document.getElementById("registerMessage").textContent =
                    "Please enter valid registration details.";
            } else {
                document.getElementById("registerMessage").textContent =
                    "Registration successful! Welcome, " + name + ".";
                this.reset();
            }
        });

    // Shopping cart
    let cart = [];
    let total = 0;

    function addToCart(productName, price) {
        cart.push({ name: productName, price: price });
        total += price;
        displayCart();
    }

    // Display cart items and total
    function displayCart() {
        let cartItems = document.getElementById("cartItems");
        cartItems.innerHTML = "";

        cart.forEach(function(item) {
            let li = document.createElement("li");
            li.textContent = item.name + " - ₹" + item.price;
            cartItems.appendChild(li);
        });

        document.getElementById("cartCount").textContent = cart.length;
        document.getElementById("total").textContent = total;
    }

    // Clear all cart items
    function clearCart() {
        cart = [];
        total = 0;
        displayCart();
    }
</script>

</body>
</html>
← Back to timeline