HTML Test

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sample Long HTML and JavaScript Code</title>
</head>
<body>

<h1>Sample Long HTML and JavaScript Code</h1>

<div id="content">
  <p>This is a sample paragraph.</p>
  <ul>
    <li>Item 1</li>
    <li>Item 2</li>
    <li>Item 3</li>
  </ul>
</div>

<button id="changeColorBtn">Change Color</button>

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

</body>
</html>

JS

document.addEventListener("DOMContentLoaded", function() {
  // Function to change the background color
  function changeColor() {
    var randomColor = '#' + Math.floor(Math.random()*16777215).toString(16); // Generate random color
    document.body.style.backgroundColor = randomColor; // Set body background color
  }

  // Event listener for the button click
  document.getElementById("changeColorBtn").addEventListener("click", changeColor);
});

Video