1. Technology

JavaScript 101

What You Need to Learn JavaScript and Where to Find It

By

Casual businessman typing at his desk
Klaus Vedfelt/Taxi/Getty Images

Prerequisites

Perhaps you are just looking for information on where to get pre-built JavaScripts to use on your site. Alternatively, you may want to learn how to write your own JavaScripts. In either case, the two things that you most definitely need are a web editor and one (or more) browsers.

You need the web editor so that you can edit your web pages and add the JavaScript to the HTML (HyperText Markup Language) already on your page. To be able to do this, you need to know the difference between pasting text into a web page and pasting code. To add JavaScripts to your page, you need to be able to paste code.

If you use a web editor where you code the HTML tags yourself, then you already know how to add code to your page. If instead you use a WYSIWYG ("what you see is what you get") web editor, then you will need to locate the option in the program that allows you to paste code instead of text.

The web browser is needed to test your page after you have added the JavaScript to check that the page still looks the way that it is supposed to and that the JavaScript performs its intended function. If you want to be sure that the JavaScript works in multiple browsers, then you will need to test it in each browser separately. Each browser has its own quirks when it comes to some aspects of Javascript.

Using Pre-Built Scripts

You don't have to be a programming wizard to use JavaScript. There are a lot of programmers out there (myself included) who have already written JavaScripts that perform a lot of the functions that you may want to incorporate into your web pages. Many of these scripts are freely available for you to copy from script libraries for use on your own site. Usually all you need to do is follow a series of instructions provided with the script to customize it, and then you paste the into your web page.

What restrictions are placed on your use of these scripts? Usually not many. In most cases, the only restriction is that you only alter those parts of the script that you are told to change to customize the script for your site. Most scripts contain a copyright notice identifying the original author and the website from which the script was obtained. These notices must be kept intact when you use scripts obtained in this way.

What's in it for the programmer? Well, if someone sees the script on your site and thinks to themselves, "What a cool script, I wonder if I can get a copy?" they will most likely view the source code of the script and see the copyright notice. The programmer therefore gets the credit he or she deserves for writing the script, and perhaps more visitors to their own site to see what else they have written.

The biggest problem, though, with pre-built scripts is that they do what their author wanted them to do, which is not necessarily what you want. To resolve this problem, you need to either drastically modify the script or write your own. To do either of these will require that you learn to program with JavaScript.

Learning Javascript

If you want to teach yourself to program with JavaScript, the two main sources of information are web pages and books. Both provide you with a wide range of resources, from beginners tutorials through to advanced reference pages. What you need to do is to locate the books or websites aimed at your level. If you start out using books or sites that are aimed at more advanced programmers, then a lot of what they are saying will be incomprehensible to you, and you won't achieve your goal of learning to program with Javascript.

Beginners will need to be particularly careful to select a book or website tutorial that doesn't assume prior programming knowledge.

If you prefer not being left to figure it out for yourself, then the web has advantages over books in that many websites provide a means for you to contact the author and/or other readers who can provide you with some assistance when you get stuck on some particular point.

Where even that isn't enough and you want face-to-face teaching, then check with your local college or computer store to see if any courses are available in your area.

Find It Here

Whichever course of action you decide to take, we have loads of resources available to help. If you are looking for pre-built scripts, then check out the Script Library. You can also Create Custom Scripts of your own.

We have an introductory tutorial series to help you Learn Javascript, as well as tutorials available to help you with Form Validation and Popup Windows.

Remember that you are not alone in using Javascript. Join our Javascript community on the Forum.

  1. About.com
  2. Technology
  3. JavaScript
  4. Reference
  5. JavaScript 101

©2014 About.com. All rights reserved.