Spaces:
Running

project1 / script.js
rid2244's picture
Create script.js
e5bd0e4 verified
Raw History Blame Contribute Delete
1.95 kB
// Universal JS file targeting interactions on multiple pages
document.addEventListener("DOMContentLoaded", () => {
// --- 1. Interaction for Home Page (index.html) ---
const welcomeBtn = document.getElementById("welcomeBtn");
const welcomeOutput = document.getElementById("welcomeOutput");
if (welcomeBtn && welcomeOutput) {
welcomeBtn.addEventListener("click", () => {
welcomeOutput.innerHTML = "<h3>🤝 System Online</h3><p>Hello! This verification proves that custom dynamic scripts are running properly directly from Hugging Face Cloud Infrastructure.</p>";
welcomeOutput.style.borderLeft = "4px solid #10b981";
});
}
// --- 2. Interaction for Skills Page (skills.html) ---
const skillsBtn = document.getElementById("skillsBtn");
const countText = document.getElementById("countText");
let count = 0;
if (skillsBtn && countText) {
skillsBtn.addEventListener("click", () => {
count++;
countText.textContent = count;
countText.style.color = "#2563eb";
countText.style.fontWeight = "bold";
});
}
// --- 3. Interaction for Contact Page (contact.html) ---
const submitBtn = document.getElementById("submitBtn");
const formFeedback = document.getElementById("formFeedback");
const inputName = document.getElementById("name");
if (submitBtn && formFeedback) {
submitBtn.addEventListener("click", () => {
if (inputName && inputName.value.trim() !== "") {
formFeedback.innerHTML = `<p style="color: green; font-weight: bold;">✔️ Thank you, ${inputName.value}! Your submission data was processed successfully by local client execution script.</p>`;
} else {
formFeedback.innerHTML = `<p style="color: red;">❌ Please fill out the required form parameters first.</p>`;
}
});
}
});