Monday, April 15, 2024

program to create a sales page using html CSS and JavaScript

Creating a basic sales page using HTML, CSS, and JavaScript involves structuring the HTML for content, styling it with CSS, and adding interactive elements with JavaScript. Here's a simplified example to get you started:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sales Page</title>
  <link rel="stylesheet" href="styles.css">
</head>
<body>

  <header>
    <h1>Amazing Product</h1>
    <p>Welcome to our sales page!</p>
  </header>

  <section class="product-info">
    <img src="product-image.jpg" alt="Product Image">
    <h2>Product Description</h2>
    <p>This is the best product you'll ever find!</p>
    <button id="buy-btn">Buy Now</button>
  </section>

  <footer>
    <p>Contact us at: example@email.com</p>
  </footer>

  <script src="script.js"></script>
</body>
</html>

In this example:Replace "styles.css" with your CSS file containing the styles for the page.Replace "product-image.jpg" with the actual path to your product image.Replace "script.js" with your JavaScript file containing any interactive functionality.And here's an example of styles.css:/* styles.css */



body {
  font-family: Arial, sans-serif;
}

header {
  background-color: #f0f0f0;
  padding: 20px;
  text-align: center;
}

.product-info {
  margin: 20px auto;
  width: 80%;
  text-align: center;
}

img {
  width: 300px;
  height: auto;
}

button {
  padding: 10px 20px;
  background-color: #4CAF50;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
}

button:hover {
  background-color: #45a049;
}

footer {
  background-color: #333;
  color: white;
  text-align: center;
  padding: 10px;
}



And for the JavaScript functionality (in script.js):// script.js


document.getElementById("buy-btn").addEventListener("click", function() {
  alert("Thank you for your purchase!");
});


This JavaScript code adds a simple functionality where clicking the "Buy Now" button triggers an alert message. You can expand this script to handle actual purchasing logic if needed.

No comments:

Computer Terms

The termination of the process due to a program or system fault      -      Abend(abnormal ending) To terminate a process before completion....