-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaulajs12.html
More file actions
52 lines (38 loc) · 1.5 KB
/
Copy pathaulajs12.html
File metadata and controls
52 lines (38 loc) · 1.5 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
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Aula 11</title>
<script>
var hello=100;
function soma(a, b) {
return a+b;
}
function gerarNumeros() {
var numero = Math.random() * 100;
var li = document.createElement("li");
li.innerHTML = "Valor " + numero;
if(Math.floor(numero) % 2 == 0) {
var lista = document.getElementById("listaPares");
} else {
var lista = document.getElementById("listaImpares");
}
lista.appendChild(li);
contador++;
}
function limpaItens() {
document.getElementById("listaPares").innerHTML = '';
document.getElementById("listaImpares").innerHTML = '';
}
</script>
</head>
<body>
<h1>JavaScript Aula 11</h1>
<h2>for, Math.random()</h2>
<button onclick="gerarNumeros(10);">Gerar números</button>
<button onclick="limpaItens();">Limpa Itens</button>
<ol id="listaPares" style="width: 50%; background-color: lightgoldenrodyellow">
</ol>
<ol id="listaImpares" style="width: 50%; background-color: lightpink">
</ol>
</body>
</html>