Applets and Scripting

JAVA

Spend some time on the Web and you'll see many references to "Java". Java, a programming language, has become extremely popular for creating applets. Applets are little programs that run inside a Web page. With applets, you can display animation, sound, games, and general utilities like calculators or search engines.

In order to create an applet, you would write a program from scratch in the Java language, compile it, and then add it your page with the <applet> tag.

You can also use Java to create stand-alone applications that have nothing to do with the Web.

JAVASCRIPT and VBSCRIPT

Even though the names are similar, Java and JavaScript are very different. Java is a compiled language, which means it must be converted to machine code before it can executed on a computer. JavaScript is an interpreted language and it interpreted line by line as it is executed by the operating system. Java applications can stand alone, but JavaScript is always tied to a Web page and can never be run separately. JavaScript depends on HTML to run.

JavaScript was created by Netscape and VBScript by Microsoft. VBScript , which stands for Visual Basic Scripting,, is similar to the programming language Visual Basic, a modern version of BASIC. VBScript is similar to JavaScript. For this discussion, however, we will look at JavaScript as it is easier to develop and is the more popular of the two.

JavaScript can be used to extract data from databases and present requested information. It is often used to present random image and information for games or advertising. Probably the most common use is to make sure users fill out forms completely and correctly.

The easiest way to include JavaScript in a page is to use the <script> tag. The programming statements fall between the <script> starting tag and </script> ending tag. The script element can be placed in the head section or body section of your document or both. There is o limitation to the number of script elements that can be placed in a document.

When you entered this module you were prompted to enter you name. Here is the result of that script.

#1 Student -

To see how this was done view the page source. Notice that is it accomplished by a script in the head section and in the body.

Creating your own script requires the knowledge of the Javascript language and more advanced programming skills than what you have acquired in this course. However, there are resources available where you can copy and paste script others have create to use on your page. Here are a few good resources:

http://www.webmonkey.com http://www.htmlgoodies.com http://www.megawebtools.com

These sites offer both Java Applet and JavaScript resources. These are a great way to spice up a page, keep things interesting, and provide useful tools for your user. Don't be afraid to experiment and try them out.


There is not a java assignment.

1