-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjavascript.js
37 lines (24 loc) · 1006 Bytes
/
javascript.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
35
36
37
function validacion(mail) {
var nombre = document.getElementById('nombre').value;
var mail = document.getElementById('mail').value;
var tel = document.getElementById('tel').value;
var subject = document.getElementById('subject').value;
var comentarios = document.getElementById('comentarios').value;
re=/^([\da-z_\.-]+)@([\da-z\.-]+)\.([a-z\.]{2,6})$/
if(nombre != "" && mail != "" && tel != "" && subject != "" && comentarios!= ""){
if(!re.exec(mail)){
alert('ingrese un mail valido');
return (false);
}
else{
alert('Se abrira una ventana para enviar tu mensaje');
window.location.href ='mailto:mydonut@gmail.com?subject='
+ encodeURIComponent(subject)
+ "&body="
+ encodeURIComponent(
"Nombre y Apellido: " + nombre + "\r" +
"Mail: " + mail + "\r" +
"Tel: " + tel + "\r" +
"Comentarios: " + comentarios);
}
}}