forked from silciampe/TPO-obligatorio-CaC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontacto.html
125 lines (108 loc) · 4.77 KB
/
contacto.html
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>El Portazo/Contacto</title>
<link rel="icon" type="image/x-icon" href="./img/logoepbyn.png">
<link rel="stylesheet" href="css/styles.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital@1&display=swap" rel="stylesheet">
<script src="https://kit.fontawesome.com/5388f691ef.js" crossorigin="anonymous"></script>
<script defer src="ham.js"></script>
</head>
<body>
<header>
<nav>
<a href="index.html">
<img class="logo" src="img/logoepbyn.png" width=60px height=60px alt="logo El portazo">
</a>
<ul class="menu">
<li><a href="nosotros.html">Nosotros</a></li>
<li><a href="producciones.html">Producciones</a></li>
<li><a href="contacto.html">Contacto</a></li>
</ul>
<button class="nav-toggle" aria-label="Abrir menú">
<i class="fa-solid fa-bars"></i>
</button>
</nav>
</header>
<section>
<div class="espacio">
<div class=titulo2><span>¡Podemos hacer grandes cosas juntos!</span></div>
<div class="formulario">
<h3>Dejanos tu consulta</h3>
<form action="https://formspree.io/f/xoqbnznz" method="POST" class="form" id="form">
<div>
<label for="nombre"></label>
<input type="text" id="nombre" placeholder="Nombre y Apellido" name="nombre" required>
</div>
<div>
<label for="email"></label>
<input type="text" id="email" placeholder="Email" name="email" required>
</div>
<div>
<label for="mensaje"></label>
<textarea rows=5 placeholder="Escribe aquí tu mensaje" id="mensaje" name="mensaje" required></textarea>
</div>
<div>
<button class="boton" type="submit">Enviar</button>
</div>
</form>
</div>
</div>
</div>
</section>
<script>
const formulario = document.getElementById('form')
const userName = document.getElementById('nombre')
const userEmail = document.getElementById('email')
const userMensaje = document.getElementById('mensaje')
const regUserName = /^[A-Za-zÑñÄáÉéÍíÓóÚú\s]+$/;
const regUserEmail = /^[a-z0-9]+(\-[_a-z0-9]+)*@[a-z0-9 ]+(\.[a-z0-9 ]+)*(\.[a-z]{2,15})$/;
const enviar = () => {
if (!regUserName.test(userName.value)) {
alert('El Nombre no es válido');
userName.focus()
return false;
}
else if (!regUserEmail.test(userEmail.value)) {
alert('El email no es válido');
userEmail.focus()
return false;
}
return true;
}
let form = document.getElementById('form');
form.addEventListener('submit', handlesubmit);
async function handlesubmit(event) {
event.preventDefault();
let valido = enviar();
if (valido == true) {
let form= new FormData (this);
let response = await fetch(this.action, {
method: this.method,
body: form,
headers:{
'Accept': 'application/json'
}
})
if (response.ok) {
this.reset();
alert ('Gracias por contactarnos. A la brevedad nos comunicaremos contigo');
}
}
}
</script>
<footer>
<div id="iconos">
<a href="https://www.instagram.com/"><i class="fa-brands fa-square-instagram"></i></a>
<a href="https://www.youtube.com/ "><i class="fa-brands fa-youtube"></i></a>
<a href="https://twitter.com/home"><i class="fa-brands fa-twitter"></i></a>
</div>
<div class="copyright">El Portazo - Copyright Silvina Ciampechini - Douglas Ojeda - Daniela Patané. © Todos los Derechos Reservados 2022.</div>
</footer>
</body>
</html>