Getting started With Javascript 1.5S2C Home « Getting started With Javascript 1.5

JavaScript is an object oriented, event driven scripting language that works on multiple platforms and allows us to add dynamics to our web pages. Whereas HTML is all about the structure and CSS the presentation, JavaScript allows us to change the behaviour of elements.

Unlike server-side languages, such as PHP, which have to communicate with a web server before actioning events, Javascript responds immediately in client side mode, leading to much faster response times for users. In the following tutorials we will start with the basics and gradually introduce more advanced topics as we move through the lessons.

We will ensure that we keep the HTML (structure), CSS (presentation) and Javascript (behaviour) seperated from each other to conform to best practice.

The Javascript 1.5 specification works in all modern browsers including all current versions of Internet Explorer. For the latest version of JavaScript which doesn't work in all current versions of Internet Explorer but should work in everything else visit the JavaScript 1.8 part of the site.

In this lesson we create the ubiquitous 'Hello World' program using JavaScript to get us started on our journey into the dynamic world of JavaScript programming.

This will introduce us to the look of some basic JavaScript code and lead nicely into the following lessons in the basics section.

Following is sample code that will make an alert box appear with the text 'Hello World!' when the 'Run Hello World' button below is pressed.

<script type="text/javascript">
  alert('Hello World!');

Press the button below to action the above code:

Reviewing Our Changes

When you click on the 'Run Hello World' button the sample Javascript code is run and the alert box appears with the code we entered for the alert.

The actual JavaScript to create the alert box in our example was placed within the <head></head> HTML element, but can also be placed within the <body></body> HTML element.

We will cover placement of code in JavaScript Basics - Lesson 4: Applying JavaScript.

Lesson 1 Complete

In this lesson we created a simplistic JavaScript program, which popped up an alert window, just to get a feel for the language and take an early look at some of the syntax involved.

What's Next?

In the next lesson we look more closely at JavaScript syntax and demystify all those brackets and punctuations.

go to home page Homepage go to top of page Top