JavaScript

Definition of JavaScript in The Network Encyclopedia.

What is JavaScript?

A cross-platform, object-based scripting language that is similar to C but simpler in syntax. JavaScript was developed by Netscape Communications and built into the Netscape Navigator Web browser version 2.0 and later. JavaScript enables Web developers to produce Web pages with dynamic functionality such as animated graphics, browser detection, cookies, scrolling text, form handlers, and authentication without having to write or invoke Common Gateway Interface (CGI) applications. JavaScript can be used to develop both client and server applications, but it is usually run on the client Web browser.

How it works

JavaScript scripts are placed in standard Hypertext Markup Language (HTML) files using special tags. Here is a simple example:

<HTML>
<HEAD><TITLE>Javascript Test</TITLE></HEAD>
<BODY>
<H1>Knock Knock</H1>
<SCRIPT LANGUAGE="JavaScript">
alert("Who's there?");
</SCRIPT>
</BODY>
</HTML>

The <SCRIPT> and </SCRIPT> tags identify and contain the actual JavaScript script. When this page is loaded into a Web browser such as Netscape Navigator version 3.0, the browser reads the script and interprets it, causing an alert dialog box to be displayed with the message “JavaScript Alert: Who’s there?” and an OK button that closes the dialog box when clicked.

NOTE

JavaScript is not the same as Java, which is an object-oriented programming language. A syntactically similar scripting language called JScript is supported on Microsoft Internet Explorer.