From a0fde55107ce08fa0ead0719f965d89894836a6a Mon Sep 17 00:00:00 2001 From: Danat Date: Mon, 17 Aug 2026 11:38:01 +0000 Subject: [PATCH] Carrier Meeting invitation site v1 --- script.js | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 script.js diff --git a/script.js b/script.js new file mode 100644 index 0000000..72edae2 --- /dev/null +++ b/script.js @@ -0,0 +1,55 @@ +document.addEventListener('DOMContentLoaded', function() { + const form = document.getElementById('registrationForm'); + const successMessage = document.getElementById('successMessage'); + + form.addEventListener('submit', function(e) { + e.preventDefault(); + + const formData = new FormData(form); + const data = { + firstName: formData.get('firstName'), + lastName: formData.get('lastName'), + company: formData.get('company'), + position: formData.get('position'), + email: formData.get('email'), + phone: formData.get('phone'), + country: formData.get('country'), + dietary: formData.get('dietary') + }; + + console.log('Заявка на участие:', data); + + form.style.display = 'none'; + successMessage.style.display = 'block'; + + setTimeout(() => { + alert('Спасибо за подтверждение участия!\n\nВаша заявка:\n' + + data.firstName + ' ' + data.lastName + '\n' + + data.company + ' — ' + data.position + '\n' + + data.email + '\n' + + data.phone + '\n' + + 'Страна: ' + data.country + '\n\n' + + 'Мы свяжемся с вами для уточнения деталей.'); + }, 500); + }); + + const phoneInput = document.getElementById('phone'); + phoneInput.addEventListener('input', function(e) { + let x = e.target.value.replace(/\D/g, '').match(/(\d{0,1})(\d{0,3})(\d{0,3})(\d{0,2})(\d{0,2})/); + if (!x[2]) { + e.target.value = x[1] ? '+' + x[1] : ''; + } else { + e.target.value = !x[3] ? '+7 (' + x[2] : '+7 (' + x[2] + ') ' + x[3] + (x[4] ? '-' + x[4] : '') + (x[5] ? '-' + x[5] : ''); + } + }); + + const inputs = form.querySelectorAll('input, select, textarea'); + inputs.forEach(input => { + input.addEventListener('focus', function() { + this.parentElement.classList.add('focused'); + }); + input.addEventListener('blur', function() { + this.parentElement.classList.remove('focused'); + }); + }); +});