-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
50 lines (39 loc) · 1.12 KB
/
script.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
/* BOTÕES DE VITORIA E DERROTA */
const vitorias = document.getElementById("quantidadeVitorias");
const derrotas = document.getElementById("quantidadeDerrotas");
vitorias.innerHTML = 0;
derrotas.innerHTML = 0;
var count = 0;
function acrescentar () {
count++;
vitorias.innerHTML = count;
}
function subtrair () {
count--;
vitorias.innerHTML = count;
}
var count2 = 0;
function acrescentar2 () {
count2++;
derrotas.innerHTML = count2;
}
function subtrair2 () {
count2--;
derrotas.innerHTML = count2;
}
/*CALCULO DE SLP */
const btn = document.querySelector("#calcular");
btn.addEventListener("click", function(e) {
e.preventDefault();
const inicio = document.querySelector("#init").value;
const final = document.querySelector("#final").value;
const resultado = document.querySelector(".resultado");
console.log(inicio);
console.log(final);
console.log(final - inicio);
let calculo = document.createTextNode(final - inicio);
resultado.appendChild(calculo);
btn.addEventListener("click", function () {
resultado.removeChild(calculo);
})
})