-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
89 lines (59 loc) · 2.51 KB
/
index.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style media="screen">
#sh {
background-color: rgb(157, 128, 30);
text-align: center;
padding: 20px 20px 20px 20px;
}
</style>
</head>
<body>
<script type="text/javascript">
</script>
<h1>javascript code to display date on button click</h1>
<p>The date and time right now is</p>
<p id="yo"></p>
<button type="button" name="button" onclick="document.getElementById('yo').innerHTML=Date()">Click me to see time</button> /* javascript is very case sensetive and it doesnt consider stuff like this as comment! */
<hr>
<h1>Methods to Add and delete elements</h1>
<p id="change">Hello see me change</p>
<button type="button" name="button" onclick="document.getElementById('change').innerHTML='I just changed!'">Yo dood I am the changing button</button>
<button type="button" name="button" onclick="document.getElementById('change').innerHTML='Hello see me change'">Reset the above text</button>
<hr>
<img id="meme" src="resources/images/meme1.jpg" alt="Dood this is a meme">
<br>
<button type="button" name="button" onclick="document.getElementById('meme').src='resources/images/meme2.jpg'">Watch part 2 of this meme</button>
<button type="button" name="button" onclick="document.getElementById('meme').src='resources/images/meme1.jpg'">Watch part 1 of this meme</button>
<hr>
<p id=size>Watch me resize!</p>
<button type="button" name="button" onclick="document.getElementById('size').style.fontSize='2pc'">Change font size</button>
<button type="button" name="button" onclick="document.getElementById('size').style.fontSize='1pc'">Reset</button>
<hr>
<p id="show-hide">Think how you could use this!</p>
<button type="button" name="button" onclick="document.getElementById('show-hide').style.display='none'">Hide</button>
<button type="button" name="button" onclick="document.getElementById('show-hide').style.display='block'">Show</button>
<hr>
<p>Single button show and hide a division</p>
<button onclick="showhide()">Show-Hide</button>
<div id="sh">
See me dissapear!
</div>
<script>
function showhide() {
var x = document.getElementById("sh");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
<hr>
</body>
</html>