Introducing JavaScript
- The Basics
- Objects
- Functions
- Events
- BOM
- Basic DOM
- DOM Tables
- DOM Forms
- Server Interaction
- Regular Expressions
- Cookies
- Error Handling
- Using Functions
- Object Oriented
- Extend Objects
- Animation
- Homework Questions
- The Bad Bits
- Extras
- Forum
JavaScript has changed a great deal since it was first introduced but many sites still use outdated techniques. There are even lots of JavaScript tutorials on the web that show you how JavaScript should be written so that it can work in Netscape 2 rather than so that it will work in modern browsers. As a result there are many people who are writing what they think is JavaScript but where what they are producing is more suited to the 20th Century than to the 21st.
Beginners should work through all the basic examples prior to moving on to the other examples which cover separate aspects of JavaScript in more detail.
Most of the JavaScript examples here will work in IE5+, Opera7+ and all versions of Firefox, Safari and Chrome. Those commands introduced in ECMAScript 5 in 2011 are being added to the site where they are supported by the latest version of all popular browsers. Where these new commands are not supported by IE8 or IE7 that information is included in the text since those two browsers might still have to many users for you to ignore. So few people using other browsers fail to keep their browser up to date that lack of support in older versions of other browsers will not have any significant affect.
Two more new DOM examples
The Document Object Model is the biggest portion of javaScript and so needs the most examples to show all the different commands. These two new examples cover five DOM commands not covered by the other examples on the site so far - firstChild and lastChild and nodeName, nodeType and nodeValue
Built in Objects
JavaScript is a prototyping language - that means that you define objects using other objects as their prototype. You don't need to create all the objects yourself though because JavaScript has a number of the most useful objects built in so that even beginners can use them in their scripts without needing to know too much about how objects work in JavaScript.
Getting Started
For those of you visiting the site for the first time please start by reviewing the examples in the basics section. Even if you think you already know some JavaScript, what you already know may be how to write JavaScript for the 1990s rather than how to write it now.
For those who don't already know JavaScript that section will introduce you to the core JavaScript commands and the most appropriate way to code them. From there you can go on to work your way through the other sections to build on that introduction.
For those who do already know some JavaScript the section on the bad bits of JavaScript will give you a rundown of those parts of JavaScript that you might already be using that you should unlearn in order to write JavaScript properly.
The Bad Bits
It is amazing the huge number of scripts that exist that misuse JavaScript commands resulting in inefficient, obtrusive, antiquated JavaScript. The bad bits section of this site lists many of the common JavaScript commands that beginners incorrectly use in their scripts which either ought to never have been a part of the language in the first place or where they have very specialised uses that actually makes them advanced topics rather than something for beginners. Beginners should NEVER use the commands from this section. See the individual pages to find out why.
Animation
This section provides a number of working examples of how to add several different types of animation to your page. If the type of animation you are after isn't listed please let me know so I can add further sub-sections.
This site is © copyright Stephen Chapman - Felgall Pty Ltd 2011-2012.
You are welcome to use any the example JavaScript from this site in the scripts for your site or any that you develop for others but may not use the longer example scripts that contain a copyright notice in any other way without permission.