-
Notifications
You must be signed in to change notification settings - Fork 18
/
1_javascript.html
48 lines (46 loc) · 1.07 KB
/
1_javascript.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JAVASCRIPT TUTORIAL</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/html_tutorial.css">
</head>
<body>
<header>
HEADER
<nav>
NAV
</nav>
</header>
<div id="main">
MAIN
<div id="content1" class="content">
CONTENT1<br>
<div class="title">
TITLE
</div>
<div class="description">
DESCRIPTION
</div>
</div>
<div id="content2" class="content">
CONTENT2
</div>
</div>
<footer>
FOOTER
</footer>
<script>
var content2_html = document.getElementById("content2").innerHTML;
document.getElementById("content2").innerHTML = content2_html
+ "<br><div class='title'>TITLE</div>";
var nav = document.getElementsByTagName("nav")[0];
console.log(nav);
nav.onclick = function() {
alert("You've just clicked nav!");
}
</script>
</body>
</html>