GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — PetCare-Scheduler-w-JavaScript-HTML5-CSS/script.js at main · BrianGator/PetCare-Scheduler-w-JavaScript-HTML5-CSS

Expand file tree

/

script.js

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
56 lines (47 loc) · 1.75 KB
/

script.js

Copy path

File metadata and controls

56 lines (47 loc) · 1.75 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
* script.js
* Functionality for the Pet Care Professional Portfolio
*/
document.addEventListener('DOMContentLoaded', () => {
const recForm = document.getElementById('recForm');
const recContainer = document.getElementById('rec-container');
const popup = document.getElementById('popup');
const homeBtn = document.getElementById('homeBtn');
// Task 1: The Home icon works correctly and navigates to the top of the page
if (homeBtn) {
homeBtn.addEventListener('click', () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
});
}
// Task 3: showPopup is triggered only when a new recommendation is submitted
function showPopup() {
if (popup) {
popup.style.display = 'flex';
setTimeout(() => {
popup.style.display = 'none';
}, 3000);
}
}
if (recForm) {
recForm.addEventListener('submit', (e) => {
e.preventDefault();
const nameInput = document.getElementById('recName');
const textInput = document.getElementById('recText');
if (nameInput.value && textInput.value) {
// Add new recommendation card
const newRec = document.createElement('div');
newRec.className = 'rec-card';
newRec.innerHTML = `
<p class="rec-text">"${textInput.value}"</p>
<p class="rec-author"><strong>— ${nameInput.value}</strong></p>
`;
recContainer.appendChild(newRec);
// Reset form
nameInput.value = '';
textInput.value = '';
// Trigger popup
showPopup();
}
});
}
});
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.