Friday, 14 July 2023

comment generator AI

Save the code in an HTML file and open it in a web browser. The tool will display a paragraph element that initially says "Click the button to generate a comment." When you click the "Generate Comment" button, it will randomly select a comment from the predefined list and display it in the paragraph element.

Please note that this example does not involve AI or the mymemory library. It simply generates random comments from a predefined list using JavaScript.


<!DOCTYPE html>
<html>
<head>
  <title>AI Comment Generator</title>
  <style>
    body {
      font-family: Arial, sans-serif;
      background-color: #f3f3f3;
    }

    .container {
      max-width: 600px;
      margin: 0 auto;
      padding: 20px;
      background-color: #fff;
      box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
      border-radius: 5px;
    }

    h1 {
      color: #333;
      text-align: center;
    }

    .comment {
      margin-bottom: 10px;
    }

    .button {
      display: block;
      width: 100%;
      padding: 10px;
      background-color: #4CAF50;
      color: #fff;
      text-align: center;
      text-decoration: none;
      border-radius: 3px;
      cursor: pointer;
    }

    .button:hover {
      background-color: #45a049;
    }
  </style>
</head>
<body>
  <div class="container">
    <h1>AI Comment Generator</h1>

    <div class="comment">
      <p id="commentText">Click the button to generate a comment.</p>
    </div>

    <button class="button" onclick="generateComment()">Generate Comment</button>
  </div>

  <script>
    var comments = [
      "Great job! I love it.",
      "This is amazing. Well done!",
      "I'm impressed. Keep up the good work.",
      "Fantastic! I'm really impressed with your work.",
      "You're doing great. Keep it up!",
      "Wow, this is incredible. I'm speechless.",
      "Brilliant work! I'm blown away.",
      "You're a rockstar. Keep shining!",
      "Outstanding! This is top-notch quality.",
      "Incredible effort. I'm truly impressed."
    ];

    function generateComment() {
      var commentIndex = Math.floor(Math.random() * comments.length);
      var commentText = document.getElementById('commentText');
      commentText.textContent = comments[commentIndex];
    }
  </script>
</body>
</html>


No comments:

Post a Comment

configuration of website

Menu Type: Dropdown with Full Width Ensure the navigation items in the dropdown menu contain relevant keywords related to the we...