Java vs. JavaScript

The most important thing to note about JavaScript is that it is not Java.

Java: Java is an object-oriented programming language that was created by Sun Microsystems. It has the ability to create standalone applications and applets.

JavaScript: JavaScript, which was developed by Netscape, is a much simpler and smaller language than Java. It usually resides inside HTML documents and does not have the ability to create applets or standalone applications. The primary use of JavaScript is to provide levels of interactivity far beyond typically flat HTML pages -- without the need for server-based CGI (Common Gateway Interface) programs. Images can change when a mouse is moved over them and calculations can be made without the use of a CGI program.

Although Java and JavaScript are very different, they do share many vocabulary and syntax constructions. They can also be very powerful when used together. JavaScript can be used to link HTML form elements to Java applets (and plug-ins) or link Java applets to each other. Java and JavaScript share a number of vocabulary and syntax constructions, but the languages are intended for very different purposes. For this lesson we will concentrate on JavaScript.

JavaScript is usually located within the head of the page (between the <title> and the </head>), although it can also be placed in the body. JavaScript begins with <script language="JavaScript"> and ends with </script>. Everything located between // and the end of that line is considered a comment and will be ignored. It is important to comment when you write your own JavaScript so that you and others will be able to understand it when you go back and look at the code.

The best way to learn and use JavaScript is to look at and use the scripts that other people have written and used. These scripts can be viewed the same way as HTML, by selecting the view source on your browser. When "borrowing" JavaScript it is important to remember not to change any of the code. Every space and line break is in there for a reason and removing anything could cause the JavaScript not to work properly.


http://hotwired.lycos.com/webmonkey/programming/javascript/tutorials/tutorial1.html
http://www.dannyg.com/ref/javavsjavascript.html


| HORT 605 Index | Syllabus | Course Modules | Teachers | Class Directory | Check Grades | Links | Aggie Horticulture |

| Creating Tables | Creating Frames | Extra Extra! | Glass Dog | Assignment | Course Modules |