The JavaScript Diaries: Part 1 | WebReference

The JavaScript Diaries: Part 1

The JavaScript Diaries: Part 1

By 

JavaScript is a versatile language. It can be used to create menus, validate forms, provide interactive calendars, post the current day's headlines, produce background effects on a Web page, track a visitor's history on your site, and play games, among many other things. That's probably why it's one of the most popular languages on the World Wide Web.

Netscape created JavaScript in 1995. Originally called "LiveScript," it was designed to make Web pages more interactive. In the beginning the language was plagued with security problems which, for the most part, have been overcome. The current version of JavaScript is 1.5.

Because of its usefulness, I've long thought about whether I should learn JavaScript programming or not. One of the main reasons I kept putting it off was the availability of free, existing scripts. 'Why re-invent the wheel?', I kept asking myself. If I could spend a few minutes searching my favorite sites for scripts (such as JavaScript Source and ScriptSearch), why should I spend my time learning how to write them? And so it went on for several years.

Today, there is a lot more that JavaScript can do and as a result, I've decided the time has come to learn it. My intention is not to become a JavaScript guru or programming genius but to be able to write scripts that I can use in my work, and perhaps share with others.

I know that I'm not the only one who feels this way and yet, learning JavaScript seems to be a monumental task. When you look at some of the JavaScripts out there, they can seem pretty intimidating. And that's true with most things that are new. Remember the first time you viewed the source code of an HTML document or took a look at a style sheet? Whoa! I'm sure you felt overwhelmed..

Still, there is only one way to get started; you just do it! To make the process easier, I decided we could do this together.As I study the JavaScript language, I will share what I have learned with you, the reader. Our goal in this study will be to learn how to competently write useful JavaScripts (these installments will be published on a bi-weekly basis).

To give you some some insight into my background, I'm no different than most of you. I'm not a programmer nor do I have any high-level technical degrees. I have learned HTML, XHTML, and a few other things on my own using books, Web sites, existing examples, and by asking questions. That's how many of the people who design Web sites today got their start.

If you have any problems or questions that are beyond my scope of knowledge, you can visit the JavaScript forums over at WebDeveloper.com. They should be able to answer all your questions. In fact, the moderator of the forum is our own Jonathan Fenocchi. He writes a regular column for us here at WebRef.

For instructional purposes, I will be using the following two references:

In addition, I will be using a few other books and Web sites that will help in our understanding of this intriguing language.

Before We Begin

There are a few things you will need before we begin our study. One of them is a basic knowledge of HTML/XHTML. While you don't need to be an expert, you will need to know the basics of using HTML elements and attributes. JavaScript can be used to dynamically create Web pages and a general knowledge of HTML is essential. A little knowledge of CSS won't hurt either.

Another thing you will need is a text (ASCII) editor. JavaScript code is just plain text so any good text editor will work well.. There aren't too many JavaScript editors out there right now (although I am reviewing one as we go through this process). There are, however, several good text editors. One editor I am very familiar with is NoteTab (which comes in three versions). I use it for all my HTML and text editing. You can read a review I wrote about it on the Web Developer's Virtual Library (it's a few years old but there has only been one minor upgrade since then). You can also use WordPad or Notepad. It would be best not to use a word processor or a WYSIWYG HTML editor as they tend to add a lot of extra code that will cause the scripts to fail.

It's assumed that you have a Web browser (a.k.a. "client", "user agent"). You should test your scripts in both Internet Explorer and Netscape. It would also be wise to test them in Firefox and Opera, as these browsers are becoming more popular. There are other browsers also but these are the main ones being used today. Safari is another popular browser but it is used on the Apple system, which makes it hard to test using a Windows-based system.

Now let's get started!


Created: April 15, 2005

URL: http://webreference.com/programming/javascript/diaries/1