Introducing JavaScript

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.

A few examples of what we can expect from EcmaScript 6 are also included in their own section so you can see the direction that JavaScript is moving in - even though it will probably be quite a while before we can use those commands.

There is a link to jsBin at the bottom right of all the pages. This site provides an easy way to test your JavaScript code online without needing to create an entire web page to run a simple test.


Browsers run on all sorts of different devices now and are no longer limited to just running on computers. Many of these devices are portable and can be used from all sorts of different locations. Some web pages that are intended specifically for use with these mobile devices may need to know where the device […]


The navigator object is the least useful of the browser related objects in JavaScript. While it contains a range of different values, these are often browser specific and many of those that are common to multiple browsers are able to have their values set to anything your visitor wants it to contain. About the most […]

Resizing or Moving a Window

Because browsers now give greater control to the person who owns the browser, the JavaScript commands to resize or move a window may or may not work depending on the browser settings.

Close A Window

Because browsers can now display multiple pages at once in different tabs, the person using the browser will not want one of those pages to close the browser. JavaScript therefore has restrictions built in so that you can only close a window from JavaScript that you opened with JavaScript. Some browsers will ask if the […]

Open A Window

Early browsers didn’t have tabs and so could only opwn one web page at a time. You had to spawn another browser window when you wanted to display a new page that didn’t overwrite the existing one. Browsers now are far more flexible allowing multiple pages to be displayed within the one browser window using […]

This site is © copyright Stephen Chapman - Felgall Pty Ltd 2011-2015.

Privacy Policy | Terms and Conditions

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.