forked from danielscarvalho/FTT-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaulajs10.html
More file actions
35 lines (29 loc) · 1014 Bytes
/
Copy pathaulajs10.html
File metadata and controls
35 lines (29 loc) · 1014 Bytes
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
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Aula 10</title>
<script>
var contador = 100; //Variável global
function novoItem() {
let i = 10;
var lista = document.getElementById("lista");
var li = document.createElement("li");
li.innerHTML = "Item " + contador;
lista.appendChild(li);
contador++;
}
function limpaItens() {
var lista = document.getElementById("lista");
lista.innerHTML = '';
}
</script>
</head>
<body>
<h1>JavaScript Aula 10</h1>
<h2>createElement</h2>
<button onclick="novoItem();">Novo Item</button>
<button onclick="limpaItens();">Limpa Itens</button>
<ol id="lista" style="width: 50%; background-color: aqua">
</ol>
</body>
</html>