Carrier Meeting invitation site v1
This commit is contained in:
parent
49f40bf1e5
commit
a0fde55107
55
script.js
Normal file
55
script.js
Normal file
@ -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');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
Loading…
Reference in New Issue
Block a user