html
This commit is contained in:
22
html/script.js
Normal file
22
html/script.js
Normal file
@@ -0,0 +1,22 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const dateElement = document.getElementById("javascriptdate");
|
||||
|
||||
function updateDateTime() {
|
||||
const now = new Date();
|
||||
dateElement.textContent = `Current date and time: ${now.toLocaleString()}`;
|
||||
}
|
||||
|
||||
// Update once on load
|
||||
updateDateTime();
|
||||
|
||||
// Optional: Update every second
|
||||
setInterval(updateDateTime, 1000);
|
||||
|
||||
// Fun interaction: click the title to change color
|
||||
const header = document.querySelector(".specialboi");
|
||||
header.addEventListener("click", () => {
|
||||
header.style.color = header.style.color === "teal" ? "crimson" : "teal";
|
||||
});
|
||||
});
|
||||
|
||||
console.log("shit happened");
|
||||
Reference in New Issue
Block a user