My Profile

Thursday, January 20, 2011

Introduction to Java Script

You're about to begin a journey into the depths of JavaScript, one of the hottest new languages for Web page development. JavaScript enables Web pages to be interactive and intelligent, and can add excitement to an otherwise dreary page.

If you've worked with HTML-the language of the Web-and have a basic idea of the concepts of programming, you should have no trouble understanding JavaScript. It's a simple and flexible language. This chapter starts with an introduction to JavaScript: its history, its features, and its limitations.

What Is JavaScript?

An explanation of exactly what JavaScript is has to begin with Java. Java is a new kind of Web programming language developed by Sun Microsystems. A Java program, or applet, can be loaded by an HTML page and executed by the Java Interpreter, which is embedded into the browser.
Java is a complex language, similar to C++. Java is object-oriented and has a wide variety of capabilities; it's also a bit confusing and requires an extensive development cycle. That's where JavaScript comes in.
JavaScript is one of a new breed of Web languages called scripting languages. These are simple languages that can be used to add extra features to an otherwise dull and dreary Web page. While Java is intended for programmers, scripting languages make it easy for nonprogrammers to improve a Web page.
JavaScript was originally developed by Netscape Corporation for use in its browser, Netscape Navigator. It includes a convenient syntax, flexible variable types, and easy access to the browser's features. It can run on the browser without being compiled; the source code can be placed directly into a Web page.
You can program in JavaScript easily; no development tools or compilers are required. You can use the same editor you use to create HTML documents to create JavaScript, and it executes directly on the browser (currently, Netscape or Microsoft Internet Explorer).
JavaScript was originally called LiveScript, and was a proprietary feature of the Netscape browser. JavaScript has now been approved by Sun, the developer of Java, as a scripting language to complement Java. Support has also been announced by several other companies.
Although useful in working with Java, you'll find that JavaScript can be quite useful in its own right. It can work directly with HTML elements in a Web page, something Java can't handle. It is also simple to use, and you can do quite a bit with just a few JavaScript statements. You'll see examples of the power of JavaScript throughout this guide.

History of JavaScript

As mentioned before, the history of JavaScript begins with Java. Java was originally developed by Sun Microsystems for use in "real-time embedded systems"-in other words, consumer electronics. Java has now become the de facto standard for advanced Internet programming, but you may still see it running your cellular phone someday.
Java was designed to operate on a virtual machine-a piece of software that interprets the Java code and acts on it as if it were a computer in itself. The virtual machine was designed to be simple so it could be implemented easily in a device. This is what makes it easy to implement in Web browsers.

Java was originally supported only by HotJava, an experimental Web browser developed by Sun for that purpose. Recognizing its potential, Netscape integrated it into its Web browser, Netscape Navigator. Because Navigator is the most popular browser, this greatly increased the publicity for Java.
In 1995, Java became the hottest new buzzword for the Internet, but few people actually knew how to program it. Netscape Communications recognized the need for a simple, clear language for Web pages and introduced LiveScript, the first of the Web scripting languages.
LiveScript had a syntax based on Java, but was more concise and easier to learn. It was also a directly interpreted language rather than a compiled language like Java. Netscape built LiveScript into the beta versions of Netscape Navigator. Support for LiveScript began with version 2.0b1, released in June 1995.
Later in 1995, Netscape reached an agreement with Sun. Sun also recognized that a simple scripting language was a good idea, so they officially endorsed LiveScript. Thus, the connection with Java became official, and the name changed to the one you're familiar with: JavaScript.
At this writing, JavaScript is still being developed and continues to improve. Netscape's support for JavaScript is expected to be finalized by the end of 1996, and other companies-most notably, Microsoft-are rushing to release competing products. Microsoft Internet Explorer (MSIE) 3.0, currently in beta, supports basic JavaScript, along with Microsoft's answer to JavaScript, VBScript. 


** If you like this post please like our page in facebook


Post a Comment


Twitter Delicious Facebook Digg Stumbleupon Favorites More