-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncao.js
90 lines (63 loc) · 2.01 KB
/
funcao.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
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
function validar() {
var nome = document.getElementById("cNome");
if (nome.value == ""
|| nome.value.length <10
|| nome.value.length >50 )
{
window.alert('Preencha seu nome corretamente');
nome.focus();
return false;
}
var email = document.getElementById("cEmail");
if (email.value == ""
|| email.value.indexOf('@')==-1
|| email.value.indexOf('.')==-1
|| email.value.indexOf('com')==-1 )
{
window.alert('Preencha um e-mail válido');
email.focus();
return false;
}
var assunto = document.querySelectorAll("input[name=tAssunto]:checked");
if (assunto.length < 1)
{
window.alert("Selecione ao menos um assunto");
return false;
}
var mensagem = document.getElementById("cMensagem");
if (mensagem.value == ""
|| mensagem.value.length <10
|| mensagem.value.length >500 )
{
window.alert('Por favor, digite sua mensagem corretamente');
mensagem.focus();
return false;
}
var chec = document.getElementById("cCheck");
if (chec.checked == false)
{
window.alert('Por favor, aceite a politica de privacidade');
chec.focus();
return false;
}
else
{alert('Obrigado sr(a) ' + nome.value + ' os seus dados foram encaminhados com sucesso!!!');
window.location.replace("index.html");
return false;
}
}
/* function Enviar() {
var nome = document.getElementById("nome");
var email = document.getElementById("email");
var mensagem = document.getElementById("mensagem");
if (nome.value == "") {
alert('Preencha seu nome');}
else if (mensagem.value == "") {
alert('Preencha a mensagem') ;
}
else if (email.value == "" ) {
alert('Preencha seu email') ;
}
else
{alert('Obrigado sr(a) ' + nome.value + ' os seus dados foram encaminhados com sucesso');
window.location="index.html";