A Javascript Tutorial for Beginners

This Javascript tutorial is for people with little or no experience with programming. It covers these topics:

  • The Definition of Javascript
  • The History of Javascript
  • Java Versus Javascript
  • Learning Javascript
  • A Basic JavaScript Example

The Definition of Javascript

  • JavaScript is a type of programming language that works with HTML to make web pages more interactive. For instance, if you had a trivia quiz on a web page you could use JavaScript to check the answers.
  • Javascript is limited. It is not a full-featured programming language like Java or C++.
  • Think of the JavaScript language as a simple, easy-to-use programming language that has only the features necessary to make web pages interactive.

The History of Javascript

  • When the Web was first created in the early 1990s all web pages were static. In other words there were no popup windows, no shopping carts, no flying thingy's etc. Pages just stayed still.
  • At that time Netscape Navigator and Internet Explorer were the top browsers. Netscape (now owned by AOL) was the first to create a programming language that would allow web pages to become interactive.
  • Netscape called it Livescript.
  • In 1995 Livescript was renamed JavaScript. The new name was partly because Java (the full-featured programming language) was becoming popular and partly because Netscape was working closely with the creators of Java - Sun Microsystems.
  • In 1997 a standards group, the European Computer Manufacturer's Association (ECMA), approved the JavaScript language as an official standard.
  • The ECMA then became responsible for the continued development of the language.
  • JavaScript is now officially called ECMAScript or ECMA-262. Most people still call it JavaScript.

JavaScript Versus Java

  • Javascript and Java are both programming languages.
  • Javascript was created with features to add interactivity to the Web.
  • Java was created with features for almost any application on almost any computer.
  • It's a sure sign you are a rookie if you call JavaScript 'Java'.
  • Here's more information on: Java Vs JavaScript.

Learning JavaScript

  • Find a 'real' project that you want to do. Build a website and learn JavaScript techniques to make it better. You'll learn more if you have a real goal for the JavaScript you are learning. If you would like to see a real-life example see: JavaScript: Open New Window.
  • How about Javascript rollover buttons on your site? They are attractive and they are useful in pointing out links to your rookie visitors. Do you want people to see several pictures but you don't have room on the page? Create a Javascript slideshow!
  • Take one step at a time. Javascript knowledge accumulates over time.
  • Keep all of your scripts in an easily searchable library. You will probably need the same functionality again in the future.
  • Teach others what you learn. You will learn more and will reinforce the knowledge you do have by teaching others.

A Basic JavaScript Example


<h1>This is a heading</h1>

<p>This is the paragraph text. This is more paragraph text. This is more paragraph text. </p>

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

  • Everything between <script type="text/javascript"> and </script> is the script.
  • The type="text/javascript" in the opening <script> tag tells the browser that the script is in text form and is JavaScript.
  • There is only one line in this script: alert("Hello World"). It causes a JavaScript alert to popup with the words "Hello World" on it. The text between the double quotes in the command gets displayed in the alert.

Try it!

Cha: the author of this site.

Copy the text in the box above and paste it into a text editor like Notepad or BBEdit. Save it as basicJavaScript.html. Now open it in your browser to see what your web page looks like. Change something to see what happens. Experiment.

Did this JavaScript tutorial help? Here's another JavaScript tutorial for beginners.

Website Building Tip

Learn some HTML before you try to tackle JavaScript.

You'll be glad you did.

A Simple JavaScript Script