There is JavaScript and then there is JAVA... JavaScript is a not JAVA, but the syntax is somewhat similar. JAVA is a programming language which can create executable programs, while JavaScript runs in your web browser, and never as an executable program. JavaScript is therefore more safe to run. JAVA can also run hosted within a web page, however, each time you do this, your computer must download the entire JAVA program, which could take some time. To see this in action, just go to www.yahoo.com and try any of their free online card games.
JavaScript is used within HTML pages and can be embedded right into a page so that when you browse to that page, the JavaScript code is executed automatically. JAVA, on the other hand, has its code embedded in ".class" files and never in the HTML file. JAVA is used to create full blown applications or what are known as JAVA Applets, whereas JavaScript is used to help do tasks on a page within the HTML. JavaScript is the programming language for the web. JAVA is the programming language for professional programmers who must leverage the power of a complete programming language.
JavaScript code is in the form of English text typed in the HTML document using the <SCRIPT> tag. The code is read and executed by the web browser. Both Internet Explorer and Netscape understand JavaScript. For example, JavaScript could be used to help verify that a user has entered in the proper information in a submission form (like when you enter your name, address, user name, password and so forth)
JAVA applets are stored on the web as "class" files and the code is in these files, not embedded in the HTML as with JavaScript. These class files, ending with the file extension ".class", are read by a special "java virtual machine" program which is not part of your web browser. Operating systems today come with a Java Virtual Machine built in so that you can run these class files as programs.
Before you venture into the world of JavaScript or JAVA you must become proficient in creating basic web pages with HTML and HTML tools such as FrontPage. You do not have to know JavaScript to create a web site, but you will find that when the need arises, JavaScript can be a handy thing to know and have experience with.
You can write the simplest JavaScript in a matter of seconds, and right now. In your web browser window, at the URL address entry field at the top of the screen where you usually type in www addresses, simply enter the following:
javascript: alert("Hello World");
Now press the Enter key. This will cause an alert message box to appear with the words "Hello World" in it. Press OK button on this window to dismiss it. You just wrote a small JavaScript program!
Here's another one to try:
javascript: alert(window.location);
window.location evaluates to the URL at which your browser is currently at.
Making a button do something on a form:
A form button: |
Free JavaScript Programs
http://www.dynamicdrive.com
http://www.hypergurl.com
http://www.jdstiles.com
http://www.webreference.com/programming/javascript
Java Applets for your web site
The following sites have pre-programmed JAVA Applets that you can run in your
web pages. You do not need to know how to program JAVA in order to use
these applets.
www.anfyjava.com
www.demicron.se