-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
1622 lines (1438 loc) · 87.2 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
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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="Web Programming Preparation" />
<meta name="author" content="" />
<title>Web Programming | Nanosoft</title>
<link rel="icon" type="image/x-icon" href="assets/img/logo.ico" />
<!-- Font Awesome icons (free version)-->
<script src="https://use.fontawesome.com/releases/v5.15.1/js/all.js" crossorigin="anonymous"></script>
<!-- Google fonts-->
<link href="https://fonts.googleapis.com/css?family=Varela+Round" rel="stylesheet" />
<link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet" />
<!-- Core theme CSS (includes Bootstrap)-->
<link href="css/styles.css" rel="stylesheet" />
</head>
<body id="page-top">
<!-- Navigation-->
<nav class="navbar navbar-expand-lg navbar-light fixed-top" id="mainNav">
<div class="container">
<a class="navbar-brand js-scroll-trigger" href="https://thenanosoft.com">Nanosoft</a>
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarResponsive" aria-controls="navbarResponsive" aria-expanded="false" aria-label="Toggle navigation">
Menu
<i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav mx-auto ml-auto">
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#def">Definitions</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#html">HTML</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#css">CSS</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#javascript">JavaScript</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#php">PHP</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#wordpress">WordPress</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#mysql">MySQL</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#midquiz">Mid Quiz</a></li>
<li class="nav-item"><a class="nav-link js-scroll-trigger" href="#contact">Contact</a></li>
</ul>
</div>
</div>
</nav>
<!-- Masthead-->
<header class="masthead">
<div class="container d-flex h-100 align-items-center">
<div class="mx-auto text-center">
<h1 class="mx-auto text-uppercase">Web Programming</h1>
<h2 class="text-white-50 mx-auto mt-2 mb-5">Learn basics about HTML, CSS, JavaScript, PHP & Wordpress.</h2>
<a class="btn btn-primary js-scroll-trigger" href="#def">Get Started</a>
</div>
</div>
</header>
<!-- Important Headings -->
<section class="block-section bg-dark text-light" id="def">
<div class="container-fluid">
<div class="row">
<div class="col-lg-10 mx-auto">
<h2>Definitions</h2>
<br><br>
<h4 class="def-topic">Static Vs Dynamic Websites?</h4>
<p class="lead">
<b class="def-heading">Static: </b> contains web pages with fixed content coded in HTML and stored on a web server. It does not change, it stays the same, or "static" for every viewer of the site. A static website does not require web programming or database design.
<br>
<b class="def-heading">Dynamic: </b> A Dynamic Website (also referred to as a database-driven site) requires web programming and database design. A dynamic website contains information and content that changes, depending on factors.
</p>
<br>
<h4 class="def-topic">Websites Vs Web-Applications?</h4>
<p class="lead">
<b class="def-heading">Websites: </b>Websites are one-way informational feeds, they do not allow viewers to interact or communicate back to the site.
<br>
<b class="def-heading">Web-Applications: </b>Web applications are websites with functionality and interactive elements. Gmail, Facebook, YouTube, Twitter, etc. are all web apps that are dynamic, and built for user engagement.
</p>
<br>
<h4 class="def-topic">Hosting & Domain</h4>
<p class="lead">
<b class="def-heading">Hosting: </b>Web hosting is the place where all the files of your website live.
<br>
<b class="def-heading">Domain: </b>Domain name is the address of your website that people type in the browser’s URL bar to visit your website.
</p>
<br>
<h4 class="def-topic">POST Vs GET Method?</h4>
<p class="lead">
Both GET and POST method is used to transfer data from client to server in HTTP protocol.
</p>
<p>
<b class="def-heading">POST: </b> The data sent to the server with POST is stored in the request body of the HTTP request:
</p>
<ul>
<li>POST requests are never cached</li>
<li>POST requests do not remain in the browser history</li>
<li>POST requests cannot be bookmarked</li>
<li>POST requests have no restrictions on data length</li>
</ul>
<br>
<p>
<b class="def-heading">GET: </b> GET method is used to appends form data to the URL in name or value pair.
</p>
<ul>
<li>GET requests can be cached</li>
<li>GET requests remain in the browser history</li>
<li>GET requests can be bookmarked</li>
<li>GET requests have length restrictions</li>
</ul>
</div>
</div>
</div>
</section>
<!-- HTML -->
<section class="block-section bg-light" id="html">
<div class="container-fluid">
<div class="row">
<div class="col-lg-10 mx-auto">
<h2>HTML?</h2>
<p class="lead">HTML document is a plain text file that has been encoded using <code>Hypertext Markup Language</code> (HTML) so that it appears nicely formatted in a Web browser.</p>
<br>
<h2>HTML Syntax</h2>
<pre>
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph.</p>
</body>
</html>
</pre>
<br>
<h2>Syntax Exaplanation</h2>
<ul>
<li><code><!DOCTYPE html></code> define the version of HTML.</li>
<li><code><html></code> root element of HTML page.</li>
<li><code><head></code> may contains stylesheets & meta information of HTML page.</li>
<li><code><title></code> define page title (which is shown in the browser's title bar).</li>
<li><code><body></code> body is a container for all the visible contents, such as headings, paragraphs, images, videos, hyperlinks, tables, lists, forms etc.</li>
<li><code><h1></code> heading tag.</li>
<li><code><p></code> paragraph tag.</li>
</ul>
<br>
<h2>HTML Elements</h2>
<p class="lead">An element in HTML usually consist of a <b>start tag</b> <tag name>, <b>close tag</b> </tag name> and content inserted between them. Technically, an element is a collection of <b>start tag</b>, <b>attributes</b>, <b>end tag</b>, content between them.</p>
<span class="note"><mark>Note:</mark> Some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag!</span>
<br>
<code>Element Examples:</code>
<pre>
<h1>My Heading</h1>
<p>My Paragraph.</p>
</pre>
<br>
<h2>HTML Tags</h2>
<p class="lead">HTML tags are like <b>keywords</b> which defines that how web browser will format and display the content.</p>
<code>Tag Examples:</code>
<pre>
<h1>
<p>
</pre>
<br>
<h2>HTML Attributes</h2>
<p class="lead">Attributes are special words which provide <b>additional information</b> about the elements. attribute should always be applied with opening/start tag. attribute should be applied with its <b>name</b> and <b>value</b>. we can use multiple attribute in single element with space between two attributes.</p>
<code>Attribute Examples:</code>
<pre>
<input type="text" />
<marquee direction="left" bgcolor="red">My Marquee.</marquee>
</pre>
<br>
<h2>HTML Meta Tags</h2>
<p class="lead">The <meta> tag defines metadata about an HTML document. Metadata is data (information) about data. <meta> tags always go inside the <head> element, and are typically used to specify language, character set, page description, keywords, author of the document, and viewport settings. Metadata will not be displayed on the page, but browser read that. Metadata is also SEO ranking fector.</p>
<code>Meta Tag Examples:</code>
<pre>
<head>
<meta charset="UTF-8">
<meta name="description" content="Free Web tutorials">
<meta name="keywords" content="HTML, CSS, JavaScript">
<meta name="author" content="John Doe">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
</pre>
<b>
<h2>Event Attributes</h2>
<p class="lead">HTML has the ability to let events trigger actions in a browser, like starting a JavaScript when a user clicks on an element.</p>
<p>HTML have many types of event attributes:</p>
<ul>
<li>Window Event</li>
<li>Form Events</li>
<li>Keyboard Events</li>
<li>Mouse Events</li>
<li>Drag Events</li>
<li>Clipboard Events</li>
<li>Media Events</li>
<li>Misc Events</li>
</ul>
<code>Event Attribute Examples:</code>
<pre>
<body onresize="alert("User resize the screen size");">
<input oninput="myFunction()">
<input type="text" onkeydown="keyDownFunction()">
<input ondblclick="alert("User Perform Double Click Action");">
<input type="text" oncopy="alert("You text has been copied!")" value="Try to copy this text">
</pre>
<br><br>
<h2>HTML Error Messages</h2>
<p class="lead">When a browser requests a service from a web server, an error might occur, and the server might return an error code like "404 Not Found".
But these messages are something called <b>HTTP status messages</b>. In fact, the server always returns a message for every request. The most common message is 200 OK.</p>
<br>
<b>1xx: Information</b>
<ul>
<li>100 Continue</li>
<li>101 Switching Protocols</li>
<li>103 Checkpoint</li>
</ul>
<br>
<b>2xx: Successful</b>
<ul>
<li>200 OK</li>
<li>201 Created</li>
<li>202 Accepted</li>
<li>203 Non-Authoritative Information</li>
<li>204 No Content</li>
<li>205 Reset Content</li>
<li>206 Partial Content</li>
</ul>
<br>
<b>3xx: Redirection</b>
<ul>
<li>300 Multiple Choices</li>
<li>301 Moved Permanently</li>
<li>302 Found</li>
<li>303 See Other</li>
<li>304 Not Modified</li>
<li>306 Switch Proxy</li>
<li>307 Temporary Redirect</li>
<li>308 Resume Incomplete</li>
</ul>
<br>
<b>4xx: Client Error</b>
<ul>
<li>400 Bad Request</li>
<li>401 Unauthorized</li>
<li>402 Payment Required</li>
<li>403 Forbidden</li>
<li>404 Not Found</li>
<li>405 Method Not Allowed</li>
<li>406 Not Acceptable</li>
<li>407 Proxy Authentication Required</li>
<li>408 Request Timeout</li>
<li>409 Conflict</li>
<li>410 Gone</li>
<li>411 Length Required</li>
<li>412 Precondition Failed</li>
<li>413 Request Entity Too Large</li>
<li>414 Request-URI Too Long</li>
<li>415 Unsupported Media Type</li>
<li>416 Requested Range Not Satisfiable</li>
<li>417 Expectation Failed</li>
</ul>
<br>
<b>5xx: Server Error</b>
<ul>
<li>500 Internal Server Error</li>
<li>501 Not Implemented</li>
<li>502 Bad Gateway</li>
<li>503 Service Unavailable</li>
<li>504 Gateway Timeout</li>
<li>505 HTTP Version Not Supported</li>
<li>511 Network Authentication Required</li>
</ul>
<div class="col-lg-4 mx-auto">
<button class="btn btn-info">
<a href="https://www.w3schools.com/tags/ref_httpmessages.asp" text-white target="_blank" class="text-light" style="text-decoration: none;">View Error Messages Detail</a>
</button>
</div>
<br>
<h4>HTML Tags</h4>
<div class="table-responsive">
<table class="table table-bordered">
<label>Basic Tags</label>
<thead>
<tr>
<th>Tag</th>
<th>Description</th>
</tr>
</thead>
<tbody class="html-tags">
<tr>
<td>< !DOCTYPE ></td>
<td>Define document type or version of HTML</td>
</tr>
<tr>
<td>< html ></td>
<td>Define html document</td>
</tr>
<tr>
<td>< head ></td>
<td>Contains metadata/information for the document</td>
</tr>
<tr>
<td>< title ></td>
<td>Defines a title for the document</td>
</tr>
<tr>
<td>< body ></td>
<td></td>
</tr>
<tr>
<td>< h1 to h6 ></td>
<td>Define headings 1 to 6</td>
</tr>
<tr>
<td>< p ></td>
<td>Define a paragraph</td>
</tr>
<tr>
<td>< br ></td>
<td> Define single break line </td>
</tr>
<tr>
<td>< hr ></td>
<td>Define horizontal line</td>
</tr>
<tr>
<td>< !-- ... -- ></td>
<td>Define Comment</td>
</tr>
</tbody>
</table>
</div>
<div class="col-lg-4 mx-auto d-block">
<button class="btn btn-success">
<a href="https://www.w3schools.com/tags/default.asp" text-white target="_blank" class="text-light" style="text-decoration: none;">Click to View HTML all tags.</a>
</button>
</div>
</div>
</div>
</div>
</section>
<!-- CSS -->
<section class="block-section bg-dark text-light" id="css">
<div class="container-fluid">
<div class="row">
<div class="col-lg-10 mx-auto">
<h2>CSS?</h2>
<p class="lead">
CSS stands for Cascading Style Sheets. <br>
CSS describes how HTML elements are to be displayed.
</p>
<br>
<h2>CSS Syntax</h2>
<p class="lead">A CSS rule consists of a selector and a declaration block: <br>
<b class="def-heading">Selector</b> may be HTML tag, id & class <br>
<b class="def-heading">Declaration Block</b> in curly braces contains one or more declarations separated by semicolons. <br>
<b class="def-heading">Declaration</b> includes a CSS property name and a value, separated by a colon.<br>
</p>
<div class="col-lg-6 mx-auto">
<img class="col-lg-12" src="assets/img/img_selector.jpg" alt="">
</div>
<br>
<h2>How to add CSS with HTML?</h2>
<p class="lead">There are 3 ways to attach CSS with HTML.</p>
<ul>
<li><b class="def-heading">Inline:</b> CSS use by "style" attribute.
<ul>
<li>Example: <pre class="def-topic"><p style="color:red;"></pre></li>
</ul>
</li>
<li><b class="def-heading">Internal:</b> the internal style is defined inside the <code><style></code> element, inside the <code><head></code> section.
<ul>
<li>Example:
<pre class="def-topic">
<head>
<style>
p {
color:red;
}
/<style>
</head>
</pre>
</li>
</ul>
</li>
<li><b class="def-heading">External:</b> style sheet use by <code><link></code> tag inside <code><head></code> tag. External CSS file save with .css extension.
<ul>
<li>Example:
<pre class="def-topic">
<head>
<link href="/style.css">
</head>
</pre>
</li>
</ul>
</li>
</ul>
<br>
<h2>CSS Comment</h2>
<p class="lead">A CSS comment starts with <code>/*</code> and ends with <code>*/</code></p>
<br>
<h2>CSS Padding & Margin</h2>
<p class="lead">
<b class="def-heading">Padding: </b>properties are used to generate space around an element's content, inside of any defined borders.
<br>
<b class="def-heading">Margin: </b>properties are used to create space around elements, outside of any defined borders.
</p>
<div class="col-lg-6 mx-auto">
<img src="assets/img/paddin-margin.png" alt="" class="col-lg-12">
</div>
</div>
</div>
</div>
</section>
<!-- JavaScript -->
<section class="block-section bg-light" id="javascript">
<div class="container-fluid">
<div class="row">
<div class="col-lg-10 mx-auto">
<h2>JavaScript?</h2>
<p class="lead">
JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language. While it is most well-known as the scripting language for Web pages. JavaScript is case-sensitive language.
<br>
JavaScript is a prototype-based, <abbr title="event-driven, functional, imperative">multi-paradigm</abbr>, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.
</p>
<h2>JavaScript Framework</h2>
<p class="lead">
There are many useful Javascript frameworks and libraries available:</p>
<ul>
<li>Angular</li>
<li>React</li>
<li>jQuery</li>
<li>Vue.js</li>
<li>Node.js</li>
<li>Backbone.js</li>
<li>etc.</li>
</ul>
<h2>JavaScript Supported Datatypes</h2>
<p class="lead">
According to the latest ECMAScript release, following are the data types supported in Javascript:
</p>
<ul>
<li>Boolean</li>
<li>Number</li>
<li>String</li>
<li>Object</li>
<li>Null</li>
<li>Undefined</li>
<li>Symbol</li>
</ul>
<h2>JavaScript Primitive or Non-Primitive Datatypes</h2>
<p class="lead">
Primitive:
</p>
<ul>
<li>Boolean</li>
<li>Number</li>
<li>String</li>
<li>Null</li>
<li>Undefined</li>
</ul>
<p class="lead">
Non-Primitive:
</p>
<ul>
<li>Object</li>
<li>Date</li>
<li>Array</li>
</ul>
<h2>JavaScript Vs JScript</h2>
<p class="lead">
Both JavaScript and Jscript designed for to make web page More dynamic.
<br><br>
<b>JavaScript: </b> JavaScript is a scripting language developed by <b>Netscape Communications</b> designed for developing <b>client</b> and <b>server</b> Internet applications.
<br><br>
<b>JScript: </b> JScript is owned by <b>Microsoft</b> and used in one of the most popular web browser Microsoft’s Internet Explorer. JScript can also be called “Microsoft’s JavaScript”.
</p>
<div>
<h2>Pros & Cons of JS</h2>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>Pros</th>
<th>Cons</th>
</tr>
<tr>
<td>Fast to the end user</td>
<td>Security Flows on user end</td>
</tr>
<tr>
<td>Simplicity</td>
<td>More and better Competitor</td>
</tr>
<tr>
<td>Versatility</td>
<td>File Download [JavaScript file is download on client machine so anyone can read the code and reuse it.]</td>
</tr>
</table>
</div>
</div>
<br>
<div>
<h2>JavaScript Where to Add</h2>
<p class="lead">There are 3 ways to attach javascript with web pages or HTML Documents</p>
<ul>
<li><b class="def-heading">Inline:</b> use by html <code>events</code> attributes.
<ul>
<li>Example: <pre class="def-topic"><input type="button" onclick="alert("This alert call by inline Java Script");"></pre></li>
</ul>
</li>
<li><b class="def-heading">Internal:</b> JS embed in <code><head></code> or <code><body></code> tag using <code><script></code> tag.
<ul>
<li>Example:
<pre class="def-topic">
// use javascript in head section
<head>
<script>
function myFunction() {
alert("This alert call by internal Java Script");
}
/<script>
</head>
// use javascript in body tag before closing body section
<body>
<p>...</p>
<h2>...</h2>
<script>
function myFunction() {
alert("This alert call by internal Java Script");
}
/<script>
</body>
</pre>
</li>
</ul>
</li>
<li><b class="def-heading">External:</b> JS use by <code><link></code> tag inside <code><head></code> section. External JavaScript file save with .js extension.
<ul>
<li>Example:
<pre class="def-topic">
<head>
<link href="/script.js">
</head>
</pre>
</li>
</ul>
</li>
</ul>
</div>
<br>
<div>
<h2>JavaScript Statement</h2>
<p class="lead">
A computer program is a list of <b>"instructions"</b> to be <b>"executed"</b> by a computer. <br>
In a programming language, these programming instructions are called <b>"statements"</b>. <br> <br>
JavaScript statements are composed of: <br>
<b>Values</b>, <b>Operators</b>, <b>Expressions</b>, <b>Keywords</b>, and <b>Comments</b>.
<br><br>
The statements are executed, one by one, in the same order as they are written.
</p>
</div>
<br>
<div>
<h2>JavaScript Syntax</h2>
<p class="lead">
JavaScript syntax is the set of rules, how JavaScript programs are constructed. <br>
<pre>
var a, b, c; // Declare Variables
a = 5; b = 6; // Assign Values
c = a + b; // Compute Values
document.write(c); // output on HTML document
document.log(c); // output on browser console tab
</pre>
</div>
<br>
<div>
<h4>JavaScript Keywords</h4>
<p class="lead">JavaScript keywords are used to identify actions to be performed.</p>
<code>Example:</code>
<p>
"var" keyword is identifiy to perform declaration of variable. <br>
"function" keyword is identify to perform function statement.
</p>
<br>
<h4>JavaScript Variables</h4>
<p class="lead">In a programming language, variables are used to store data values.</p>
<br>
<h4>JavaScript Operators</h4>
<p class="lead">An operator is a character that represents an action.</p>
<p>in javascript have many types of operators:</p>
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>Operators</th>
<th>Symbols</th>
</tr>
<tr>
<td>Arithmetic Operators</td>
<td>+, -, *, /, %, ++, --</td>
</tr>
<tr>
<td>Comparison Operators</td>
<td>==, !=, >, <, <=, >=, ===</td>
</tr>
<tr>
<td>Arithmetic Operators</td>
<td>+, -, *, /, %, ++, --</td>
</tr>
<tr>
<td>Logical Operators</td>
<td>&&, ||, !</td>
</tr>
<tr>
<td>Bitwise Operators</td>
<td>&, |, ^, ~, <<, >>, >>></td>
</tr>
<tr>
<td>Conditional Operator</td>
<td>? : (if condition is true ? then value is X : otherwise value is Y)</td>
</tr>
<tr>
<td>Assignment Operators</td>
<td>=, +=, -=, *=, /=, %=</td>
</tr>
</table>
<label class="note">
Note − Same logic applies to Bitwise operators so they will become like <<=, >>=, >>=, &=, |= and ^=.
</label>
</div>
</div>
<br>
<div>
<h2>JavaScript Expression</h2>
<p class="lead">An expression is a combination of values, variables, and operators, which computes to a value.</p>
</div>
<br>
<div>
<h2>JavaScript Comment</h2>
<p class="lead">
<b>Single Line Comment: </b> denoted by <code>//</code> <br>
<b>Multiline Comment: </b> start with <code>/*</code> and end with <code>*/</code>
</p>
</div>
<br>
<div class="important-questions">
<h2>Important Questions?</h2>
<ul>
<br>
<li>strict mode in JavaScript</li>
<ul>
<li>It allows you to place a program, or a function, in a "strict" operating context. This strict context prevents certain actions from being taken and throws more exceptions.</li> <br>
<code>Example:</code>
<pre>
'use strict';
var str = "Hello World";
document.write(str);
</pre>
</ul>
<br>
<li>Scope of variable in JavaScript</li>
<ul>
<li>The scope of a variable is controlled by the location of the variable declaration, and defines the part of the program where a particular variable is accessible. <br>JavaScript has two scopes:</li>
<b class="def-heading">Global Scope</b> <br>
<b class="def-heading">Local Scope</b>
</ul>
<br>
<li>What is === Operator?</li>
<ul>
<li>The "===" operator is a binary logical operator to check whether the two values are same and are of same data type. It will return false even when their values are equal but they are not of same data type.
<br>
<b class="def-heading">For Example:</b> 555 and '555', according to the values are same but they are not of same data type, hence === will return false.
</ul>
<br>
<li>Difference b/w null & undefined</li>
<ul>
<li><b class="def-heading">undefined</b> means a variable has been declared but has not yet been assigned a value.
<br>
<code><b class="def-heading">Example:</b> var a;</code>
<li><b class="def-heading">null</b> null is an assignment value. It can be assigned to a variable as a representation of null(no) value:
<br>
<code><b class="def-heading">Example:</b> var a = null;</code>
</ul>
<br>
<li>What are JavaScript Cookies?</li>
<ul>
<li>JavaScript cookies are the small test files stored in your system and it gets created when the user visits the websites to store information that they need.</li>
</ul>
<br>
<li>Nan & isNan()?</li>
<ul>
<li><b class="def-heading">isNaN()</b> function determines whether a value is an illegal number (Not-a-Number).</li>
<li><b class="def-heading">NaN</b>The NaN property represents "Not-a-Number" value. This property indicates that a value is not a legal number.</li>
</ul>
<br>
<li>Conversion String to Number & Number to String</li>
<ul>
<li><b class="def-heading">String to Number</b></li>
<br>
<ul>
<li><b class="def-heading">parseInt()</b>: It accepts two arguments. The first argument is the "string" to convert. The second argument is called the "radix." This is the base number used in mathematical systems. </li>
<code>
var text = '42px';<br>
var integer = parseInt(text, 10);<br>
// returns 42 <br>
</code>
<li><b class="def-heading">parseFloat()</b>: Convert string into a point number. </li>
<code>
var text = '42.35px';<br>
var integer = parseInt(text);<br>
// returns 42.35 <br>
</code>
<li><b class="def-heading">Number()</b>: Sometimes it’s an integer. Other times it’s a point number. And if you pass in a string with random text in it, you’ll get NaN(Not-a-Number).</li>
<code>
Number('123'); // returns 123 <br>
Number('12.3'); // returns 12.3 <br>
Number('42px'); // returns NaN <br>
</code>
</ul>
<br>
<li><b class="def-heading">Number to String</b></li>
<ul>
<li><b class="def-heading">toString()</b>: method converts a number to a string.</li>
<code>
var num = 15; <br>
var n = num.toString(); <br>
</code>
</ul>
</ul>
<br>
<li>
Client Side Vs Server Side JS
</li>
<ul>
<li><b class="def-heading">Client Side</b>: JavaScript that enables the enhancement and manipulation of web pages and client browsers. In a browser environment , your code will have access to things provided only by the browser. The main tasks of Client side JavaScript are validating input, animation, manipulating UI elements, applying styles, some calculations are done when you don't want the page to refresh so often.</li>
<li><b class="def-heading">Server Side</b>: JavaScript that enables back-end access to databases, file systems, and servers. Server side javascript, is javascript code running over a server <b>local resources.</b></li>
</ul>
<br>
<li>DOM
<ul>
<li>DOM which is short for "Document Object Model", is the specification for how objects in a web page should appear. It is an interface that allows a programming language to manipulate the content, structure, and style of a website. </li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</section>
<!-- PHP -->
<section class="block-section bg-dark text-light" id="php">
<div class="container-fluid">
<div class="row">
<div class="col-lg-10 mx-auto">
<h2>PHP?</h2>
<p class="lead">
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
</p>
<ul>
<li>PHP is an acronym for "PHP: Hypertext Preprocessor"</li>
<li>PHP is a widely-used, open source scripting language</li>
<li>PHP scripts are executed on the server</li>
<li>PHP is free to download and use</li>
<li>PHP 7 is the latest stable release.</li>
</ul>
<br>
<div>
<h2>PHP File?</h2>
<ul>
<li>PHP files can contain text, HTML, CSS, JavaScript, and PHP code.</li>
<li>PHP code is executed on the server, and the result is returned to the browser as plain HTML.</li>
<li>PHP files have extension ".php".</li>
</ul>
</div>
<br>
<div>
<h2>PHP Do?</h2>
<ul>
<li>PHP can generate dynamic page content</li>
<li>PHP can create, open, read, write, delete, and close files on the server</li>
<li>PHP can collect form data</li>
<li>PHP can send and receive cookies</li>
<li>PHP can add, delete, modify data in your database</li>
<li>PHP can be used to control user-access</li>
<li>PHP can encrypt data</li>
</ul>
</div>
<br>
<div>
<h2>Install PHP on local system</h2>
<p class="lead">Some tools required for installation of PHP.</p>
<ul>
<li>PHP</li>
<li>Apache Server</li>
<li>MySQL Database</li>
<li>Text Editor</li>
<li>Browser</li>
</ul>
<p>PHP, Apache, MySQL all are available in XAMPP or WAMP server.</p>
</div>
<br>
<div>
<h2>What is Apache?</h2>
<p class="lead">Apache is an open-source and free web server software. The official name is Apache HTTP Server. Apache is a cross-platform software, therefore it works on both Unix and Windows servers. It allows website owners to serve content on the web — hence the name “web server.” It’s one of the oldest and most reliable web servers, with the first version released more than 20 years ago, in 1995.
<br>
we call Apache a web server, it is not a physical server, but rather a software that runs on a server. Its job is to establish a connection between a server and the browsers of website visitors.
</p>
</div>
<br>
<div>
<h2>WAMP & XAMPP stands for?</h2>
<p class="lead"><b class="def-heading">WAMP: </b>Windows, Apache, MySQL, PHP</p>
<p class="lead"><b class="def-heading">XAMPP: </b>Cross-Platform, Apache, MySQL, PHP and Perl</p>
</div>
<br>
<div>
<h2>PHP Syntax</h2>
<p class="lead"><b class="def-heading">Recommended Use: </b> <? php ?> </p>
<pre class="def-topic">
<body>
<ul>
<?php for($i=1;$i<=5;$i++){ ?>
<li> Menu Item <?php echo $i; ?> </li>
<?php } ?>
<ul>
</body>
</pre>
output:
<pre class="def-topic">
Menu Item 1
Menu Item 2
Menu Item 3
Menu Item 4
Menu Item 5
</pre>
<p class="lead"><b class="def-heading">Short Tag: </b> <?= ?></p>
<p>If you want to shorten your code as much as possible, you can go for the short_tags option. This will save you from typing <?php at the beginning of the code, shortening it to just <?. In order to enable this, you should update the php.ini file and turn the "short_tags" setting from "Off" to "On"</p>
<pre class="def-topic">
<body>
<p>Hello, today is <?= date('Y/m/d H:i:s'); ?>.</p>
</body>
</pre>
output:
<pre class="def-topic">
2012/03/06 17:33:07
</pre>
</div>
<br>
<div>
<h2>PHP Variables</h2>
<p>Rules for PHP variables:</p>
<ul>
<li>A variable starts with the <code>$</code> sign, followed by the name of the variable</li>
<li>A variable name must start with a letter <code>a,b,c,...,</code> or the underscore <code>_</code> character</li>
<li>A variable name <b>cannot</b> start with a number <code>0,1,2,...</code></li>
<li>A variable name can only contain alpha-numeric characters and underscores</li>
<li>Variable names are case-sensitive (<code>$name</code> and <code>$Name</code> are two different variables)</li>
</ul>
</div>
<br>
<div>
<h2>PHP echo & print</h2>
<p class="lead">With PHP, there are two basic ways to get output: <code>echo</code> and <code>print</code>.</p>
<b>echo Example:</b>
<pre class="def-topic">
<php
$txt1 = "Learn Web Programming";
$txt2 = "thenanosoft.github.io/WD-6B";
$x = 5;
$y = 4;
echo "<h2>" . $txt1 . "</h2>";
echo "Study PHP at " . $txt2 . "<br>";
echo $x + $y;
?>
</pre>
<b>echo Example:</b>
<pre class="def-topic">
<php
$txt1 = "Learn Web Programming";
$txt2 = "thenanosoft.github.io/WD-6B";
$x = 5;
$y = 4;
print "<h2>" . $txt1 . "</h2>";
print "Study PHP at " . $txt2 . "<br>";
print $x + $y;
?>
</pre>
</div>
<span class="note">
<mark>Note:</mark> For concatenation string we use ‘.’ dot operator
</span>
<br>
<div>
<h2>PHP String Functions</h2>