Tuesday, January 1, 2008

JavaScript

Java vs. JavaScript


Java is a programing language developed by Sun. Java allows programmers to create programs. One example is Java Applets, a small program embedded within a web page.

JavaScript is a scripting language developed by Netscape and later joined in a partnership with Sun. You can insert it directly to your HTML documents. Creating JavaScript is not difficult. What you need are only simple text editor and browser that supports JavaScript.

JavaScript


We are not going to show you how to write JavaScript here because useful JavaScripts are widely available for you to copy. You may not need to know how to write it unless you want customized Script for your site. If you want to learn how to write the script, try JavaScript for the world wide web book.

Shown below are some examples of useful JavaScripts and links to some JavaScript web sites

Alert message:


Here is the code for alert message:

<a href="j_script.html" onclick="alert('Reload this page?');">Click here</a>

Dynamic images and menus:


Dynamic menu can either be created by JavaScript or JavaApplet. The JavaScript version will work only on Netscape 3.0 or higher. JavaApplet version should work on both Netscape and Explorer but it will run much slower than JavaScript.

JavaScript example:

>>

example of dynamic menu

The principle is that you have two images. One will be displayed when you put your mouse on it, and the other will be displayed when the mouse is off the image.

Installation is easy. This code originally written by Nick Heinle and Athenia Associates. Follow the link to get detail instruction.

Customized Message in Status Bar


To see how it works, simply put your cursor over (but don't "click") on this links and watch the status bar at the bottom of your screen.

You can get this script from "Cut-N-Paste JavaScript"

Counter:


There is no example shown here. To use this counter script, your server must support server-side includes (SSI) feature. You can get it at http://www.cris.com/~adaml/Counter.shtml. The script developed by Adam Levental.

Links to JavaScript resources:



On line JavaScript Tutorial:


No comments:

Anton Subagja