Codeblock

in #codeblock6 years ago (edited)

This short tutorial is intended for beginners and enthusiast alike, in Javascript. To understand this tutorial better, it is expected that you have basic knowledge of HTML (Hyper Text Markup Language).


Image Source: gocode.academy

We will begin this edition from very easy explanations and summary, and will end with actual, simple Javascript programs that will execute across any enabled browser.

What is Javascript?

Javascript is a dynamic programming language that executes within a browser (client). It is used to add 'life' to a website.

For Javascript codes to be executed (viewed) on a browser, it will usually have to be enabled on the client (browser). The process of enabling Javascript on your browser varies from browser to browser but, is normally somewhere in the Toolsor Optionsmenu. To view the codes in this tutorial on your browser, you will have to enable Javascript on your browser (if it is not already enabled).

Javascript codes can be embedded in an HTML document using the tag,

< script>

or packaged in a separate (external) file from the HTML document and saved with the file extension '.js' (eg. test.js). When embedded in the document, it can be embedded inline (in the body of the HTML document) or embedded in the HTML header. When Javascript is embedded inline, it is not executed until the function is called within the page. When Javascript code is embedded in the document header, it is executed as the page is loaded.

Now, let's try a really easy program to see header and inline application of Javascript.


< html>
< head>
< title>JavaScript Header and Inline Application
< script type="text/javascript">
document.write("Header application of Javascript. This script is executed during page load from the header
");
< /script>
< /head>
< body>
< script type="text/javascript">
document.write("Inline application of Javascript. This script is executed during the loading of the body.
");
< /script>
< /body>
< /html>

Sort:  

@gregjava, I gave you a vote!
If you follow me, I will also follow you in return!

Coin Marketplace

STEEM 0.16
TRX 0.16
JST 0.030
BTC 59488.68
ETH 2538.17
USDT 1.00
SBD 2.52