|
Tutorials
Javascript Tutorial
by Boris
Mordkovich
INTRODUCTION
As I got farther into web development I
wanted to go beyond the limitations of HTML. HTML cannot make decisions, be very
interactive, or store information. Javascript was the answer. It was developed
by Netscape and was originally called LiveScript. The name was later changed to
show the relation to Java. Now it is supported by both of the most popular
browsers, Microsoft Internet Explorer and Netscape Navigator.
Note: Parts of this tutorial assume you know HTML. I
CONTENTS
Part 1 - Defining a Script
Part
2 - Creating a Simple Script
Part
3 - Variables, Strings, and Arrays
Part
4 - Testing and Comparing Variables
Part
5 - Loops and Functions
Part
6 - Objects
Part
7 - Events
There are 3 places you can define a script.
- The first place you can define a script is within the head of the HTML
document. Scripts here aren't automatically executed when the page loads
but can be referred to by other scripts within the document.
- The next place you can define a script is within the body of the HTML
document. Scripts here are executed as the page loads.
- The last place you can define a script is within an event handler. You
will learn more about these later.
When defining scripts in the head and body of HTML documents
you are required to use a script tag, while if you are defining a script
within an event handler, this tag is not required.
You can include the src attribute to the script tag if you would like to save
your script to an external file and include it in the HTML file. Remember to
use the .js extension when saving Javascript to an external file.
<script src="menu.js">
The above would include the Javascript from the menu.js file.
|