31 lines
989 B
JavaScript
31 lines
989 B
JavaScript
document.addEventListener('DOMContentLoaded', function() {
|
||
const form = document.getElementById('reservationForm');
|
||
|
||
form.addEventListener('submit', function(e) {
|
||
e.preventDefault();
|
||
|
||
const inputs = form.querySelectorAll('input, textarea');
|
||
const data = {};
|
||
inputs.forEach(input => {
|
||
data[input.name || input.placeholder] = input.value;
|
||
});
|
||
|
||
alert('Спасибо за бронирование! Мы свяжемся с вами в ближайшее время для подтверждения.');
|
||
form.reset();
|
||
});
|
||
|
||
const links = document.querySelectorAll('a[href^="#"]');
|
||
links.forEach(link => {
|
||
link.addEventListener('click', function(e) {
|
||
const href = this.getAttribute('href');
|
||
if (href !== '#') {
|
||
e.preventDefault();
|
||
const target = document.querySelector(href);
|
||
if (target) {
|
||
target.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
||
}
|
||
}
|
||
});
|
||
});
|
||
});
|