Welcome to the Javascript Installation Homepage, Guest!

Javascript | Installation

Javascript is easy to get set up and running. You can write script elements to store your javascript code within your HTML code, but that is not recommended. I would recommend creating a separate javascript file, like in the folder in the last tutorial, and using the javascript file to keep all of your javascript code. You can use notepad++ to edit HTML files, javascript files, and CSS files. Javascript is the default scripting language in HTML today. Javascript has functions, much like other OOP languages, that will be executed when called on. For example,

Javascript can change text, CSS features, or even make hidden objects appear.

Javascript within the Head element

Javascript within the Body element

Javascript Externally

Javascript can be located in the body or head elements of an HTML document, or both of them at the same time. The examples above illustrate how javascript can be inserted into the head, the body, or externally depending on what your preferences and needs are. If you are planning on just using a small bit of javascript, use script tags, and insert the code within your HTML document. If you plan on having a very javascript dependent web application, you will need to create external javascript files to encompass your vision. External scripts are feasible when the programmer needs to reuse the same code on many different web pages. I prefer to create individual javascript files along with specific HTML files to ensure I do not mix and match information. I might have different needs on one HTML document then I have on another one. So, I like to organize the HTML files and javascript files accordingly.

Javascript uses the file extension; .js

To place the external script inside an HTML document the user will need to have one of these

<script src="/location/to/static/script/script.js"></script>

The external script must be referenced in the head or the body element. The script will assume the data that would otherwise be located within the script tags you create. External js files do not contain script tags, of course. External files separates HTML and JS, which will ease some of the clutter caused by too much code being inside one file. The separation makes HTML, CSS, and JS much easier to read and maintain, and cached Javascript files can speed up the loading time of the web application. You can multiple scripts to one file just by adding addition script tags:

<script src="/location/to/static/javascript/file_1.js"></script>

<script src="/location/to/static/javascript/file_2.js"></script>

Javascript external scripts can be referenced with a full URL:

<script src="https://www.whateverwebsiteisyours.com/js/script1.js"></script>
Import by placing the code below in the head or body elements
<script src="/js/script1.js"></script>

Next, we will take a look at the different ways Javascript renders Output

Just follow the buttons to continue the tutorial, Guest