-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjs.html
More file actions
201 lines (144 loc) · 7.2 KB
/
js.html
File metadata and controls
201 lines (144 loc) · 7.2 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS -->
<link rel="stylesheet" href="style.css">
<!-- FONTS -->
<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=Irish+Grover&display=swap" rel="stylesheet">
<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=Dancing+Script&display=swap" rel="stylesheet">
<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=Potta+One&display=swap" rel="stylesheet">
<!-- LINKING PRISM FOR COE HIGHLIGHTING -->
<link rel="stylesheet" href="prism.css">
<script src="prism.js"></script>
<!-- TITLE -->
<title>Js Cheatsheet</title>
</head>
<body>
<!-- NAVBAR -->
<div class="navbar">
<div class="logo"><img src="./copy.png" alt=""></div>
<div class="dropdown">
<button class="dropbtn">
Language ↓
</button>
<div class="dropdown-content">
<a href="index.html">HTML cheatsheet</a>
<a href="js.html">JS cheatsheet</a>
<a href="css.html">CSS cheatsheet</a>
<a href="linux.html">Linux Commands</a>
</div>
</div>
<div class="searchBox" onkeypress="search()">
<input type="text" placeholder="Search Here" id="searchInput" onkeydown="search()">
</div>
</div>
<div class="container">
<h1 class="category"> Java Scipt</h1>
<!-- Download Button -->
<a href="https://drive.google.com/u/0/uc?id=1-lQ8ThB2rjNQKYqbCTD_MPStCffYGLbx&export=download" > <button class="btn">Download Pdf</button></a>
<ol >
<!-- LIST ITEMS -->
<li>
<!-- SHIFT +TAB DABA KE code class="code" KI INDENT KO THEEK KARNA PADEGA PRISM.JS KI WAJA SE -->
<h2>On Page Script
</h2>
<p class="heading-intro"> Adding internal JavaScript to HTML</p>
<!-- code class="code" BOX -->
<pre class="language-html"><code class="code"><script type="text/javascript"> //JS code class="code" goes here </script></code class="code"></pre>
</li>
<li>
<!-- SHIFT +TAB DABA KE code class="code" KI INDENT KO THEEK KARNA PADEGA PRISM.JS KI WAJA SE -->
<h2>External JS File
</h2>
<p class="heading-intro"> Adding external JavaScript to HTML</p>
<!-- code class="code" BOX -->
<pre class="language-html"><code class="code"><script src="filename.js"></script></code class="code"></pre>
</li>
<li>
<!-- SHIFT +TAB DABA KE code class="code" KI INDENT KO THEEK KARNA PADEGA PRISM.JS KI WAJA SE -->
<!-- Heading -->
<h2>Functions
</h2>
<!-- PARAGRAPH -->
<p class="heading-intro">
JavaScript Function syntax</p>
<!-- code class="code" BOX -->
<pre class="language-js"><code class="code">function nameOfFunction(){
// function body
}</code class="code"></pre>
</li>
<li>
<!-- SHIFT +TAB DABA KE code class="code" KI INDENT KO THEEK KARNA PADEGA PRISM.JS KI WAJA SE -->
<!-- Heading -->
<h2>DOM Element
</h2>
<!-- PARAGRAPH -->
<p class="heading-intro">
Changing content of a DOM Element</p>
<!-- code class="code" BOX -->
<pre class="language-js"><code class="code">document.getElementById("elementID").innerHTML = "Hello World!";</code class="code"></pre>
</li>
<li>
<h1>Creating Elements</h1>
<!-- SHIFT +TAB DABA KE code class="code" KI INDENT KO THEEK KARNA PADEGA PRISM.JS KI WAJA SE -->
<!-- Heading -->
<ul>
<li>
<h2>createElement
</h2>
<!-- PARAGRAPH -->
<p class="heading-intro">
Create a new element</p>
<!-- code class="code" BOX -->
<pre class="language-js"><code class="code">document.createElement('div')</code class="code"></pre>
<!-- ________________________________________________ -->
</li>
<li>
<h2>createTextNode
</h2>
<!-- PARAGRAPH -->
<p class="heading-intro">
Create a new text node</p>
<!-- code class="code" BOX -->
<pre class="language-js"><code class="code">document.createTextNode('some text here')</code class="code"></pre>
</li>
</ul>
</li>
<li>
<h1>Query/Get Elements
</h1>
<ul>
<p class="heading-intro">
The browser creates a DOM (Document Object Model) whenever a web page is loaded, and with
the help of HTML DOM, one can access and modify all the elements of the HTML document</p>
<!-- Heading -->
<li>
<h2>
querySelector
</h2>
<!-- PARAGRAPH -->
<p class="heading-intro">
Selector to select first matching element</p>
<!-- code class="code" BOX -->
<pre class="language-js"><code class="code">document.querySelector('css-selectors')</code class="code"></pre>
</li>
</ul>
</li>
</ol>
</div>
<footer>
<p class="text-center">Copyright @2022 | Designed With Prism.js <a href="#">| By-Prashant Chawla</a></p>
</footer>
<!-- <script src="script.js" defer></script> defer means that the script will be executed only after the whole document has been parsed -->
<script src="script.js" ></script>
</body>
</html>