-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathscript.js
34 lines (29 loc) · 1.32 KB
/
script.js
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
// Toggle menu for mobile view
document.querySelector('.menu-toggle').addEventListener('click', function() {
document.getElementById('nav-menu').classList.toggle('active');
});
// Form validation
document.getElementById('send-sms').addEventListener('click', function() {
const phoneInput = document.getElementById('phone').value;
const errorMessage = document.getElementById('error-message');
const phonePattern = /^\+91\d{10}$/;
if (!phonePattern.test(phoneInput)) {
errorMessage.style.display = 'block';
} else {
errorMessage.style.display = 'none';
alert('SMS sent successfully!');
}
});
// script.js
document.getElementById('pay-fee').addEventListener('click', function() {
const patientName = document.getElementById('patient-name').value;
const patientAge = document.getElementById('patient-age').value;
const patientGender = document.getElementById('patient-gender').value;
const patientFee = document.getElementById('patient-fee').value;
if (patientName && patientAge && patientGender) {
// Redirect to mock payment gateway page
window.location.href = `payment.html?name=${patientName}&age=${patientAge}&gender=${patientGender}&fee=${patientFee}`;
} else {
alert('Please fill out all fields');
}
});