javascript for people who don't want to write scripts
what is javascript?
Javascript was developed by Netscape (and was first called LiveScript) as a way to allow web designers to add some interactivity to their pages which was not available with standard HTML. In most cases, this is done by inserting one or more functions into a page (usually in the <HEAD> section) and then sending a call to the functions from the <BODY> of the page.
If you didn't understand all that, don't worry. You can still use Javascript on your pages. Many people who understand this much better than we do have written scripts which can be copied and used in your pages. (Make sure you have their permission before you do, however!)
Each of the sample pages you will be looking at has a script you can take and use in your own page along with instructions for doing just that.
The biggest problem with using Javascript in your pages is the same as using any web design advanced feature: it may not work correctly (or work at all) with some browsers, especially older versions.
javascript is not java!
JavaScript is frequently confused with Java and, despite the similar names, they are not the same at all. Java is a programming language which is often used to create "applets" which are delivered with web pages. The applet programs are run by an add-on to the operating system (called a "virtual machine"), with the results usually displayed in a browser window. JavaScript, on the other hand, is part of the web page (or is added in from an external file) and its instructions are executed by the browser itself.
Java requires a special program (usually called a "development environment" to make it seem even more difficult) to write and compile the programs, while JavaScript functions can be written in any program that can write HTML, including a text editor.
That is probably more than you need to know for this session, but if you are interested in learning more, there are many good books and web sites which can help you with the basics. Some of them are listed on the Javascript and Java Resources page.
so, where's the good stuff??
Just reading about JavaScript doesn't really tell you much. The best way to understand what scripts can do is to just jump in and try it!
Before you start, however, you need to know something about HTML. It isn't necessary to be able to write the HTML code, but you do need to understand the basic structure of a web page.
Every page, no matter how complex, has two basic sections: the <HEAD> and the <BODY>. Many Java scripts have two parts, one of which must go in the head of the page (between the <HEAD> and </HEAD> tags) and one of which goes somewhere in the body section. Some reside just in the body and a few reside only in the head section. Java applets usually just have a trigger in the body.
The scripts linked from the samples page will give you some good examples of using JavaScript to create some special effects - plus an example of using a Java applet "stolen" from a web library of applets. They are listed in rough order by level of difficulty and work involved. Each page will explain how to copy and adapt the script to your uses.
some other notes
- If you plan to take a Java script from another web page, first make sure that the author of the script has given permission (a notice is often found in a comment at the top of the script). Then the easiest way is to save the whole page, open it in your favorite web design program and then cut out anything that isn't the script. Before you build your page around the script, save it to a text file for later use.
- A good way to collect and manage JavaScript functions, both "stolen" from web pages and taken from libraries, is to put the required code into a basic text editor document (TextEdit, SimpleText, Note Pad but NOT Word Pad) and save them all in the same folder, giving them appropriate names, of course. You now have a collection which is easy to find, open, copy and paste into new pages.
- Try not to overdo these tricks. All of these functions can be very effective if done correctly and can be very annoying if not.
- Remember that not all browsers can handle Java script or Java applets and not all browsers handle it the same way. The Javascript tricks in the examples I've posted should work in versions 4 and later of both Navigator and Explorer, on both Macs and PCs. They also work in Safari, Opera and other new browsers but always test your pages on as many browsers as possible.
- After all this you should also know that there are several web and graphic design programs which will build the JavaScript for many of the most popular effects (like rollovers). All you have to do is build the images (and some will help with that) and tell the program what kind of effect you want to happen.
- For more examples, help with using scripts or with writing your own, see the links in the resources section below. The resources page offers some general suggestions for software and books that you might want to use to help build your own pages.

