-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathscript.html
More file actions
125 lines (105 loc) · 4.51 KB
/
script.html
File metadata and controls
125 lines (105 loc) · 4.51 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tag <script></title>
<link rel="stylesheet" href="utils/css/global.css">
<link rel="stylesheet" href="utils/css/embed.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
</head>
<body>
<header>
<nav>
<div class="logo">Tags HTML5</div>
<ul class="nav-links">
<li><a href="index.html">Home</a></li>
<li><a href="referencias.html">Referências</a></li>
<li><a href="sobre.html">Sobre Nós</a></li>
</ul>
</nav>
</header>
<main>
<article class="main-content">
<section class="title-section-tag">
<h1>Tag HTML5 <script></h1>
</section>
<section class="content">
<section class="example-section">
<h3>Definição e uso</h3>
<p class="description">
A tag <script> é usada para **inserir ou referenciar código JavaScript** em páginas HTML5.
Pode ser colocada dentro do <head> ou do <body> e suporta tanto scripts internos quanto externos.
<br>
<mark>Scripts internos são escritos entre <script> e </script>, enquanto scripts externos usam o atributo <code>src</code>.</mark>
</p>
</section>
<section class="example-section">
<h3>Estrutura Básica</h3>
<p class="description">
Sintaxe para script interno: <br>
<code><script>console.log('Olá Mundo');</script></code> <br><br>
Sintaxe para script externo: <br>
<code><script src="script.js"></script></code>
</p>
</section>
<section class="example-section">
<h3>Exemplo 1: Script interno</h3>
<div class="code-block">
<script><br>
alert('Bem-vindo ao site!');<br>
</script>
</div>
<h3>Exemplo 2: Script externo</h3>
<div class="code-block">
<script src="utils/js/app.js"></script>
</div>
</section>
<section class="example-section">
<h3>Exemplo 3: Script no final do <body></h3>
<p class="description">
É uma prática comum colocar scripts no final do <body> para melhorar o carregamento da página:
</p>
<div class="code-block">
<body><br>
<h1>Minha Página</h1><br>
<script src="utils/js/app.js"></script><br>
</body>
</div>
</section>
</section>
</article>
<aside class="sidebar">
<h2>Outras Tags HTML5</h2>
<input type="text" id="searchInput" placeholder="Pesquisar tag..." class="btn search-box">
<ul class="sidebar-links" id="tagList">
<li><a href="body.html"><body></a></li>
<li><a href="script.html"><script></a></li>
<li><a href="section.html"><section></a></li>
<li><a href="footer.html"><footer></a></li>
<li><a href="header.html"><header></a></li>
</ul>
</aside>
</main>
<footer>
<p>Copyright © 2025 Tutorial HTML5</p>
<p><a href="index.html">Home</a> | <a href="sobre.html">Sobre Nós</a> | <a
href="referencias.html">Referências</a></p>
</footer>
<script>
const searchInput = document.getElementById('searchInput');
const tagList = document.getElementById('tagList');
const items = tagList.getElementsByTagName('li');
searchInput.addEventListener('keyup', function () {
const filter = this.value.toLowerCase();
for (let i = 0; i < items.length; i++) {
const link = items[i].getElementsByTagName('a')[0];
const text = link.textContent.toLowerCase();
items[i].style.display = text.includes(filter) ? '' : 'none';
}
});
</script>
</body>
</html>