Google
  Home About Javascripts Books Tutorials References Software Tools Download Scripts  
ABOUT JAVASCRIPTS

Javascript is a scripting language from Netscape that is only marginally related to Java. Java and JavaScript are not the same thing. JavaScript was designed to resemble Java, which in turn looks a lot like C and C++.

The difference is that Java was built as a general-purpose object language, while JavaScript is intended to provide a quicker and simpler language for enhancing Web pages and servers. JavaScript is embedded as a small program in a web page that is interpreted and executed by the Web client. The scriptor controls the time and nature of the execution, and JavaScript functions can be called from within a Web document, often executed by mouse functions, buttons, or other actions from the user. JavaScript can be used to fully control Netscape and Microsoft Web browsers, including all the familiar browser attributes.

JavaScript (in spite of its name) has nothing whatsoever to do with Java. JavaScript is an interpreted language built into a browser to provide a relatively simple means of adding interactivity to web pages. It is only supported on a few different browsers, and tends not to work exactly the same on different versions. Thus its use on the Internet is somewhat restricted to fairly simple programs. On intranets where there are usually fewer browser versions in use, JavaScript has been used to implement much more complex and impressive programs

You may wish to read more about the Javascript.

Java, developed under the Sun Microsystems brand, is a full-fledged object-oriented programming language. It can be used to create standalone applications and a special type of mini application, called an applet. Applets are downloaded as separate files to your browser alongside an HTML document, and provide an infinite variety of added functionality to the Web site you are visiting. The displayed results of applets can appear to be embedded in an HTML page (e.g., the scrolling banner message that is so common on Java-enhanced sites), but the Java code arrives as a separate file.

JavaScript, developed by Netscape, is a smaller language that does not create applets or standalone applications. In its most common form today, JavaScript resides inside HTML documents, and can provide levels of interactivity far beyond typically flat HTML pages -- without the need for server-based CGI (Common Gateway Interface) programs.

Some server software, such as Netscape's SuiteSpot, lets web application developers write CGI programs in a server-side version of JavaScript. Both client-side and server-side JavaScript share the same core JavaScript language, but each side deals with different kinds of objects. Client-side objects are predominantly the components of an HTML web page (e.g., forms, text boxes, buttons). Server-side objects are those that facilitate the handling of requests that come from clients, as well as connectivity to databases.

It is important to understand that a Java-enabled browser is not automatically a JavaScript-enabled browser: the two technologies require entirely separate interpreters (licensed from separate companies) to handle the languages. It is unlikely, however, that future browsers will incorporate one but not the other (plus or minus implementation timetables on various platforms). Starting with Netscape Navigator 3.0, HTML authors have been able to use JavaScript to link HTML form elements to Java applets (and plug-ins) or link Java applets to each other--LiveConnect(tm), Netscape calls this technology. Rather than competing with each other, Java and JavaScript are a powerful combination.

Much simpler and smaller than the Java vocabulary, JavaScript is within reach of authors who know HTML; writing full-fledged Java, on the other hand, benefits from experience with C and C++. Java and JavaScript share a number of vocabulary and syntax constructions, but the languages are intended for very different purposes. All you need to program in JavaScript is a text editor and a JavaScript-enabled browser, such as Netscape Navigator 2.0 and later or Microsoft Internet Explorer 3 and later.

Let us clarify the following before we go any further,

JavaScript has nothing to do with Java.

JavaScript is a client side, interpreted, object oriented, high level scripting language, while Java is a client side, compiled, object oriented high level language.

Client side:

Programs are passed to the computer that the browser is on, and that computer runs them. The alternative is server side, where the program is run on the server and only the results are passed to the computer that the browser is on. Examples of this would be PHP, Perl, ASP, JSP etc.

Interpreted:

The program is passed as source code with all the programming language visible. It is then converted into machine code as it is being used. Compiled languages are converted into machine code first then passed around, so you never get to see the original programming language. Java is actually dual half compiled, meaning it is half compiled (to 'byte code') before it is passed, then fully compiled just before use. Interpreted languages are generally less fussy about syntax and if you have made mistakes in a part they never use, the mistake usually will not cause you any problems.

Scripting:

This language is devoted to performing repetitive tasks. This especially makes use of 'for' and 'while' loops. With JavaScript, we do not have to tell the browser exactly what to put on the screen for every pixel, we just tell it that we want it to change the document, and it does it.

With Javascript

  1. What Can be done
    • Interact with the browser (examples later)
    • Interact with the displayed document, or with different windows or frames
    • Respond to user input with JavaScript programmed behaviours
    • Communicate between applets or plugins in a given window.
    • Dynamically change page content while viewing page (Internet Explorer 4/5, Navigator 6)

  2. What Can not be done
    • Interact with windows/frames you did not open yourself
    • Read data from or write data to the hard disk
    • Send messages to or receive messages from other computers on the Internet (other than the one that sent the page)
    • Print to a printer
    • These restrictions are designed to make JavaScript safe

    Enjoy Javascripting!

    Once again, we trust you find this work useful.

    Thank you,

    Palani S Perumal,
    Sundararajan Anand,
    Johnny Go &
    Lim Kong Meng