-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_Teste.html
75 lines (59 loc) · 2.9 KB
/
index_Teste.html
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
66
67
68
69
70
71
72
73
74
75
<html>
<head>
<meta charset="UTF-8">
<title>Curso JavaScript</title>
</head>
<body>
<div id="app2" style="padding-bottom: 5px;">
<button onclick="mostraAlerta()">Me Pressione</button>
</div>
<div style="background-color:#00BFFF;text-align:center;padding-top: 5px;padding-bottom: 5px;">
<p>Primeira Div</p>
</div>
<div id="app1" style="padding-top: 5px;padding-bottom: 5px;">
<button onmouseover="mostraAlerta()">Passe o mouse</button>
</div>
<div style="background-color:#00BFFF;text-align:center;padding-top: 5px;padding-bottom: 5px;">
<p>Segunda Div</p>
</div>
<div id="app" style="padding-bottom: 5px;padding-top: 5px;">
<input type="text" name="nome" />
<button class="botao">Adicionar</button>
</div>
<div id="setahrefmanual" style="padding-bottom: 5px;padding-top: 5px;">
<input id="nome" />
<div class="box"></div>
</div>
<script>
//****************************************************************************
function mostraAlerta() {
alert('Botão foi criado!');
}
//****************************************************************************
//****************************************************************************
var inputElement = document.querySelector('input[name=nome]')
var btnElement = document.querySelector('button.botao')
btnElement.onclick = function() {
var text = inputElement.value;
alert(text);
}
//****************************************************************************
//****************************************************************************
//criando href via java script
var linkElement = document.createElement('a');
linkElement.setAttribute('href', 'https://skylab.rocketseat.com.br/auth')
linkElement.setAttribute('title', 'site rocket')
var textElement = document.createTextNode('Acessar site da Rocketseat!');
linkElement.appendChild(textElement);
var containerElement = document.querySelector('#setahrefmanual')
containerElement.appendChild(linkElement);
var inputElement = document.querySelector('#nome')
//containerElement.removeChild(inputElement); //se descomentar essa linha remove o input inserido la no html
//****************************************************************************
var boxElement = document.querySelector('.box');
boxElement.style.width = 100;
boxElement.style.height = 100;
boxElement.style.backgroundColor = '#f00';
</script>
</body>
</html>