JavaScript
Written
Author
As you may (or may not) know, JavaScript is not JAVA. This is a common error thinking JAVA is a shortened call for JavaScript. They are actually two very different types of coding. JavaScript is an addon script that enhances the performance or interaction of a website to its visitors. JAVA is like a small mini program in itself that is self contained and does special things.
JavaScript is a "block" type language. It views commands as separate blocks of information, binds them together, then executes them. Some examples of these blocks are document, window, src, write, and status.
Properties in JavaScipt are known as EVENTS. These events cause an action to happen under certain circumstances or instances. They are based on "LOGICAL" formulas. IF this is true THEN do this command. The formulas are based on a series of comparisons.
VERY IMPORTANT ... JavaScript is VERY picky. Be sure to pay close attention to returns and spaces or the script may not work properly. JavaScript is also CaSe SeNsItIvE. You must match up the filenames and other properties in exactness.
Using JavaScript to find and use objects is similar to finding a certain file in a certain folder on your computer. It uses a "path" format.
Example: You have a file called "MyFile.txt". It is in a folder called "Folder2". The folder is located on your C drive.
To find the location of this file, the path would be "C:\Folder2\MyFile.txt"
The same type of "path" system is used in JavaScript. It follows the path from the largest area and narrows down to a specific area or object.
As with most language commands, JavaScript follows it's own basic rules and formats. JavaScript can perform automatic functions of calculation to create a more interactive web site.
To get the browser to recognize JavaScript code, we have to place the code within SCRIPT tags :
In many tutorials, you will notice the use of the COMMENT tags within the SCRIPT tags.
These comment tags are used to "BLANK OUT" the JavaScript from any browsers that are unable to view or display JavaScript. About 98% of my viewers DO have JavaScript capable browsers and have that option turned on, so it is a very small error reducing factor.
JavaScript comes in 2 varieties :
- Auto script: Script that carries out a set of codes (known as a blocks) automatically without the need for visitor input or occurance.
- Trigger script: Script that requires some visitor input or occurance to carry out a set of codes.
Table of Contents
Learn More About JavaScript
Alert
Learn about how to give users a warning with the alert function in JavaScript.
Last Updated
Prompt
Learn about how to collect information from the user with prompts in JavaScript.
Last Updated
TimeOut
Learn about the TimeOut function in JavaScript, a way to "delay" function execution.
Last Updated
JavaScript Arrays: Everything You Need To Know
Learn all about JavaScript arrays. We go through common use cases, explain how they work, and more.
Last Updated
More JavaScript Basics
Get a brief overview of many important JavaScript concepts and functions.
Last Updated
BaseScript
Learn about BaseScript, a way to load JavaScript within the head tag of an HTML document.
Last Updated
JavaScript Variables
Learn how to "save" results of function in JavaScript variables.
Last Updated
JavaScript Functions
Learn about JavaScript functions -- one of the most powerful pieces behind how your browser runs.
Last Updated
Windows
Learn how you can create a new browser window in JavaScript.
Last Updated
Get
Learn about Get -- one of the legacy features in JavaScript
Last Updated
JavaScript Loops
Learn how to iterate over elements in an array using loops in JavaScript.
Last Updated
Preload Images
Learn how you can decrease the perceived loading time of large images that become visible after some user interaction by preloading them before they're visible.
Last Updated
NoScript
Learn about NoScript, a way to display a message to the user when their browser doesn't run JavaScript.
Last Updated
External Javascript
Learn about how you can load external files of JavaScript within your HTML files.
Last Updated
JavaScript Location
Learn about how and why you'd use JavaScript to access a browser's location.
Last Updated
Events
Learn about events in JavaScript, an incredibly important way to make websites interactive.
Last Updated
Rollover / Image Swap
Learn about how you can change what image the user sees based on whether they move their cursor over it.
Last Updated
Status Bar
Learn about how to display a status bar with JavaScript.
Last Updated
Confirm
Learn about how to collect yes or no feedback from users with the browser's confirm function in JavaScript.
Last Updated
The JavaScript Double Question Mark: How to Use Nullish Coalescing
Learn all about the nullish coalescing operator (??) — from how it’s used to how it’s different from its cousin, the OR (||) operator.
Last Updated
JavaScript String: Everything You Need to Know about the String Type in JavaScript
Learn all about the String data type in JavaScript -- from how to create them, to how to manipulate them and use different built-in operators on them.
Last Updated