-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtmlDom.html
More file actions
223 lines (221 loc) · 6.42 KB
/
htmlDom.html
File metadata and controls
223 lines (221 loc) · 6.42 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html>
<html lang="en">
<head>
<link
href="https://fonts.googleapis.com/css2?family=Pacifico&display=swap"
rel="stylesheet"
/>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>DOM practice</title>
</head>
<body>
<h1>HTML DOM practice:-</h1>
<h3>
Finding HTML Elements:
<ul>
<li>getElementById()</li>
<li>getElementsByTagName()</li>
<li>getElementsByClassName()</li>
<li>querySelector()</li>
<li>
Finding HTML Elements by HTML Object Collections
<ol>
<li>document.anchors</li>
<li>document.body</li>
<li>document.documentElement</li>
<li>document.embeds</li>
<li>document.forms</li>
<li>document.head</li>
<li>document.images</li>
<li>document.links</li>
<li>document.scripts</li>
<li>document.title</li>
</ol>
</li>
</ul>
</h3>
<!-- Html form validation using "DOM" -->
<h2>1. Html form text validation using "DOM"</h2>
<form id="form1" action="" onsubmit="return formValidationText()">
<label for="name">Name:</label>
<input name="yourName" type="text" />
<input type="submit" value="submit" />
</form>
<!-- One more form validation, numeric input validation -->
<h2>2. Html form password validation using "DOM"</h2>
<form id="form2" action="" onsubmit="return formValidationPassword()">
<label for="pass">Passowrd:</label>
<input type="password" name="yourPassword" />
<input type="submit" value="submit" />
</form>
<!-- This "p" tag for title checking -->
<p id="title_Checking"></p>
<button class="button" onclick="lighOn()">ON</button>
<button id="button" onclick="lightOff()">OFF</button>
<img
id="imageOfLight"
src="img/light-off.png"
style="
width: 100%;
height: 300px;
border-radius: 100%;
object-fit: contain;
"
/>
<!-- JS animation part -->
<h4>Animation area:</h4>
<div>
<div
id="container"
style="
width: 450px;
height: 450px;
position: relative;
background-color: gold;
"
>
<div
id="animationBox"
style="
width: 50px;
height: 50px;
position: absolute;
background-color: red;
border-radius: 50px;
text-align: center;
"
>
1
</div>
<div
id="animationBox2"
style="
width: 50px;
height: 50px;
position: absolute;
right: 0;
background-color: rgb(0, 64, 160);
border-radius: 50px;
text-align: center;
"
>
2
</div>
<div
id="myMoveAnimation"
style="
width: 50px;
height: 50px;
background-color: rgb(39, 231, 0);
border-radius: 50px;
position: absolute;
bottom: 0;
text-align: center;
"
>
3
</div>
<div
id="myMoveAnimation2"
style="
width: 50px;
height: 50px;
background-color: rgb(150, 0, 236);
border-radius: 50px;
position: absolute;
bottom: 0;
right: 0;
text-align: center;
"
>
4
</div>
<div
id="myMovAnimation5"
style="
background-color: skyblue;
width: 50px;
height: 50px;
position: absolute;
top: 200px;
left: 200px;
border-radius: 25px;
text-align: center;
"
>
5
</div>
<div
id="myMovAnimation6"
style="
background-color: rgb(239, 182, 253);
width: 20px;
height: 20px;
position: absolute;
top: 220px;
left: 220px;
border-radius: 25px;
text-align: center;
"
>
6
</div>
</div>
<button
onclick="animation()"
style="background: red; height: 50px; border-radius: 50px"
>
Animate the box1
</button>
<button
onclick="animation2()"
style="background: red; height: 50px; border-radius: 50px"
>
Animate the box2
</button>
</div>
<!-- one more animation box -->
<button onclick="animation3()">Click to see animation move 3</button>
<button onclick="animation4()">Click to see animation move 4</button>
<button onclick="myWidthAnimaTion()">Click to see width animation 5</button>
<button onclick="mySizeIncreseAni()">Click to see resize of 6</button>
<button id="button6" style="background: red; height: 50px; border-radius: 50px">All the animation at the same time</button>
<!-- DOM Events -->
<h3 onclick="this.innerHTML = 'Opps!'">Click me</h3>
<button class="buttonForEvent" id="buttonForEvent">Hello there :)</button>
<form id="form4">
<label for="en">UpperCase Input:</label>
<input type="text" id="upperCase">
</form>
<form action="" id="form5">
<label for="">LowerCase input: </label>
<input type="text" id="inputLowerCase">
</form>
<form action="" id="form6">
<label for="">Removing Blank Space:</label>
<input type="text" id="trim">
</form>
<button id="multipleAlert">Multiple Alert Button</button>
<h2>Again form validation practice</h2>
<form action="#" id="form7">
<label for="#">Input Valid Number:</label>
<input type="password" placeholder="At least 8 digit required" id="formVal">
<input type="submit" placeholder="submit">
</form>
<p id="resTex">Input validation result will be shown here as text.</p>
<p id="accessNodeText">Hello,first child node;</p>
<p id="printNodeText"></p>
<!-- DOM Nodes -->
<div id="divOfAppend">
<p id="p1">Hello1</p>
<p id="p2">Hello2</p>
<p id="p3">Hello3</p>
<p id="p4">Hello4</p>
<p id="p5">Hello5</p>
<p id="p6">Hello6</p>
</div>
<script defer="true" src="htmlDom.js"></script>
</body>
</html>