JavaScript Tutorial

JavaScript Tutorial cover image
  1. Home
  2. JavaScript
  3. JavaScript Tutorial

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.

By the way, this tutorial was written for someone who has no programming experience. And I assure you that as long as you have access to a computer (and a bit of dedication), you would be able to start programming in JavaScript.

Sponsored Links

I had put the tutorial offline for a while to correct errors. These have now been removed. However, if you find some, please do let me know. Enjoy!

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 behaviour (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:

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.

JavaScript