Java-script overview

One of the most intriguing and exciting aspects of the World Wide Web is its capability to offer interactive content to many people.

Thousands upon thousands of pages are linked together across the globe, each accessible with a single mouse click.

The Web is the largest collection of information available to a single person since the beginning of time. As incredible as these notions may be, the users of the Web demand more. As technology on the Web improves, users want more interaction, more sophistication, more visually appealing content, and above all, these users want to be able to create this content themselves.

Java has turned the promise of interactivity into reality. For the first time, programmers can create small software programs, or applets, that can be distributed and executed easily on the World Wide Web.

Netscape Communications (http://www.netscape.com) has single-handedly helped to thrust this new technology into the mainstream by incorporating Java into its popular Navigator software. For the first time, Web sites can finally interact with their users.

Sophisticated applications like paint programs, spreadsheets, games, and complex math engines can now run in the browser window, among HTML pages, without the need of specialized hardware or software, other than a Java-enabled browser such as Netscape's Navigator.

Two distinct solutions to interactive content creation have formed on the Web: the simple-to- use Hypertext Markup Language (HTML), and the sophisticated and powerful Java programming language. With these two tools, users can create the visually compelling content and have it merge seamlessly with the interactive applications that Java offers. Nevertheless, what seems to be missing is a system for bringing these two technologies closer together.

Welcome to JavaScript

Netscape Communications saw the need for a bridge between these two technologies. They began working on a new scripting language that could have a place between HTML and Java, yet be powerful enough to link the two technologies together.

When Netscape's new scripting language was introduced, it was known as LiveScript. It was immediately incorporated into their Navigator product in an effort to quickly have it adopted by the Internet community.

Soon thereafter, seeing the potential of a joint effort, Netscape and Sun teamed to help LiveScript become more mainstream and to establish it as the standard in the Internet community for Web-based scripting.

Because LiveScript syntax was so similar to Java's syntax, Sun and Netscape decided to rename their new product to make it more recognizable. It would now be called JavaScript.

Java Script was created as an easy-to-use, open, cross-platform scripting language that could link together objects and resources from both HTML and Java.

While Java applets are primarily developed by programmers, JavaScript was intended to be used by HTML page authors to dynamically control the interaction and behavior of their pages. JavaScript is unique in that it has been designed to be complementary to and integrated with both HTML and Java.

One of the most important benefits JavaScript offers is its capability to reduce network traffic by keeping simple tasks local. In other words, instead of the server performing tasks and returning the results to the browser, the browser can handle some of the tasks locally, thus giving the user quicker response times.

Java Script has been endorsed by over 25 industry-leading companies, including America Online, Inc., Apple Computer, Inc., Architext Software, Attachmate Corporation, AT&T, Borland International, Intuit, Inc., and Silicon Graphics, Inc. These companies plan to introduce products adopting the JavaScript language which will help to establish it in the Web community. Java Script has also been submitted to the appropriate standards bodies for industry review and commenting.

These four chapters on JavaScript provide an introduction into JavaScript and do not cover the entire scope of JavaScript. They are here as a starting point into your exploration of this new and unique scripting language.

Because JavaScript is still an evolving language, some of its features and commands may change in the future. Every effort has been made to make the information contained here as timely as possible.

We have professional javascript experts working with Oxxus. Take a look at our team

Learning JavaScript

JavaScript is based on the powerful Java language in its syntax and usage, yet is interpreted, not compiled. What this means is that the JavaScript application code is downloaded as text into the browser along with the HTML text. The code is executed within the browser, enabling you to develop simple applications that can interact with and assist your users.

With JavaScript, you can respond to events from the user such as mouse clicks, mouse movement over a link, and form input. You can build dynamic pages that change according to your user's requests, or even play sounds or run applets when a user enters or leaves your page.

This type of capability at the client level allows for tremendous interactivity with the users of your Web pages.

The JavaScript language resembles Java, but is simpler and easier to learn. A JavaScript application may be as short as one line or take several pages. The complexity depends on the extent in which your script interacts with the page it is in.

One of the first uses of JavaScript for most authors is in form validation. Form validation is the ability for an HTML form to check the input from a user before it is submitted, which greatly improves performance on your server as well as decreases user frustration.

Simple example of form validation:

<HTML> <BODY> <FORM NAME=”demoform” onSubmit=”if(!demoform.name.value) { alert(‘You left the email field blank’); return false; }”> <INPUT NAME=”email””> <INPUT TYPE=”submit”> </FORM> </BODY> </HTML> <HR ALIGN=CENTER>

The short HTML document is a testament to the power and simplicity of JavaScript. The document displays a form that cannot be submitted until something is entered into the name field. If the field is left blank, a window will open stating You left the name field blank. Once information has been entered, the form may be submitted normally.

Learning JavaScript isn't difficult, but requires considerably more effort than HTML. Despite its simplicity, JavaScript is based on a programming language, making it much more sophisticated than HTML.

It requires a time investment and a lot of experimentation. Fortunately, JavaScript applications are easy to develop and easy to test; this ultimately leads to a speedier grasp of the JavaScript language.

As an added benefit, by learning JavaScript, you will have begun your journey into Java programming.

JavaScript is based on Java, so many of the commands and constructs are similar, if not the same.

Contact sales!