-
Notifications
You must be signed in to change notification settings - Fork 0
/
javascript.js
33 lines (28 loc) · 935 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
window.addEventListener('load', start);
function start() {
// Capturando Tabela
var Table = document.querySelector('table');
// Adicionando Listener de change
Table.addEventListener('input', function (event) {
// Capturando inputs que receberão os resultados
let [ResultRed, ResultGreen, ResultBlue] = Array.from(
document.querySelectorAll("input[type='text']")
);
// Capturando valor dos elementos range
let [InputRed, InputGreen, InputBlue] = Array.from(
document.querySelectorAll("input[type='range']")
);
ResultRed.value = InputRed.value;
ResultGreen.value = InputGreen.value;
ResultBlue.value = InputBlue.value;
var Quadrado = document.querySelector('.Content');
Quadrado.style.backgroundColor =
'rgb(' +
ResultRed.value +
',' +
ResultGreen.value +
',' +
ResultBlue.value +
')';
});
}