-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
65 lines (54 loc) · 2.12 KB
/
scripts.js
File metadata and controls
65 lines (54 loc) · 2.12 KB
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
function startTimer(duration, display) {
let timer = duration, days, hours, minutes, seconds;
setInterval(function () {
days = parseInt(timer / 86400, 10);
hours = parseInt((timer % 86400) / 3600, 10);
minutes = parseInt(((timer % 86400) % 3600) / 60, 10);
seconds = parseInt(timer % 60, 10);
days = days < 10 ? "0" + days : days;
hours = hours < 10 ? "0" + hours : hours;
minutes = minutes < 10 ? "0" + minutes : minutes;
seconds = seconds < 10 ? "0" + seconds : seconds;
display.textContent = days + " : " + hours + " : " + minutes + " : " + seconds;
if (--timer < 0) {
timer = duration;
}
}, 1000);
}
window.onload = function () {
let duration = 737068; // Converter para segundos
display = document.querySelector('#timer'); // selecionando o timer
startTimer(duration, display); // iniciando o timer
};
const modalFuction = (event) => {
let modal = document.getElementById("modal"); // Get the modal
let button = document.getElementById("button"); // Get the button that opens the modal
let submit = document.getElementById("bnt");
let span = document.getElementsByClassName("close")[0]; // Get the <span> element that closes the modal
// When the user clicks the button, open the modal
button.onclick = function () {
modal.style.display = "flex";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function () {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
if (event.target == modal) {
modal.style.display = "none";
}
let name = document.getElementById('name')
let email = document.getElementById('email');
let contate = document.getElementById('contate');
if (name.value && email.value && contate.value != "") {
submit.onclick = function () {
alert("Enviado com sucesso!");
}
}
console.log(name.value)
console.log(email.value)
console.log(contate.value)
}
window.onclick = function (event) {
modalFuction(event);
}