Online JavaScript Tutorial
This online Javascript tutorial been very well received judging by the number of emails I get. JavaScript is a vast language and it is not possible to teach everything in these 35 tutorial sessions, however, we will cover most of the basics - statements commands and functions. This Javascript tutorial was written for someone who has no programming experience.
I had taken off this tutorial for a little while simply to correct errors, however, if you do find some, please report them here; and if you simply like this javascript tutorial, please do let me know.
JavaScript History
Web pages made using only HTML are somewhat static with no interactivity and negligible user involvement. Interactive pages can be described as those that understand and process user behavior (actions) like mouse movements, mouse button clicks, HTML button clicks etc.
HTML tags are just instructions on document layout and structure; the display of the document in the window is dependent on the browser. Interactive pages cannot be built with only HTML, we need a programming language. Further, since the response time to user actions should be quick, the programming language has to be embedded in the browser itself. (Programs residing on servers can not bring about interactivity due to the time taken for sending the user input and receiving the response.)
Keeping these things in mind, the people at Netscape came out with a client-side (read browser) language that was integrated with version 2 of Netscape Navigator. They called this language JavaScript. (Actually, JavaScript was initially christened LiveScript. Seeing the popularity gained by Sun Systems' Java, the bigwigs at Netscape changed its name... a clever marketing ploy. Eh?)
Microsoft's implementation of JavaScript is called JScript and was first introduced with version 3 of Internet Explorer.
JavaScript is thus, a client-side scripting language. There is also a server-side version that is used in Active Server Pages, a technology promoted by Microsoft. This tutorial describes only client-side JavaScript.
JavaScript enables browsers to take decisions and process information. This is the key to interactivity.
JavaScript now
At the time of writing, JavaScript is in version 1.2 and is soon to be standardized by the International Standards Organization.
Why do you need JavaScript?
Here are a few things you can do with JavaScript:
- Validate forms at the client-side saving both the precious server resources and time.
- Create mouseover effects, change background color of a document with a click of a button... interactivity!
- Randomly display content without the involvement of server programs.
- Move HTML elements around pages.
- Change page contents dynamically.
- Load content in new browser windows and frames.
- Make online games.
Nature of JavaScript
JavaScript is based on Object Oriented Programming concept. Its syntax is quite similar to C, C++ and Java. However, it is much easier to learn and implement.
Other Client-side languages like Javascript
VBScript: Implemented only under Internet Explorer, this client-side language is similar to BASIC. It is commonly used in ASP technology.
PerlScript: Similar to the Perl Language. Not very well supported by browsers.
What is covered in this Javascript tutorial?
Since this Javascript tutorial was written keeping in mind a novice, we start with the very basics, gently touching JavaScript methods and event handlers and then moving on to variables, loops, functions etc. In the following sessions on this tutorial, you will learn how to detect browsers, print current date and time on a web page, change images on mouse-over, display statements in the browser Status Bar and several other nifty things. Once you get a grasp of these sessions, you can build over what you have learnt through practice and consulting a JavaScript reference.
Embedding JavaScript in HTML - Online JavaScript lessons for Beginners
Creating your first JavaScript - Javascript basics
JavaScript Introduction - Writing JavaScript with HTML
JavaScript Guide - Object Oriented Programming in JavaScript
Understanding JavaScript objects - Online JavaScript help
Online JavaScript Guide - Methods
JavaScript Online Reference - alert() method
JavaScript Online Help - Event Handlers 1
JavaScript Event Handlers - onmouseover and onmouseout
JavaScript Event Handlers - onclick and ondblclick
Creating or Opening New Windows (pop-up) in JavaScript
JavaScript Functions - Creating and Using - 1
Learning JavaScript Programming - Variables
Learning JavaScript Functions - 2
JavaScript Operators - String and Arithmetic Operators
JavaScript increment and decrement operators - Operator Precedence
Online JavaScript Manual - Variables and JavaScript methods
JavaScript Errors - Understanding and Correcting
JavaScript IF Statement
JavaScript IF-ELSE Statement
Browser detection through JavaScript - Navigator Object
Date and Time in JavaScript
JavaScript - Else If
The JavaScript prompt - Getting user input
Global and Local variables in JavaScript Functions
Understanding JavaScript for Loop
JavaScript While Loop
JavaScript break And continue Statements For Loops
Changing Images on Mouseover Using JavaScript
JavaScript - Image Change Using Functions
Generating Random Numbers in JavaScript
JavaScript Arrays - creating and storing values
Random Text Display Using JavaScript
Random Image Display Using JavaScript
JavaScript Programming Tutorial - Last Words