javascript
javascript

What Is JavaScript?

JavaScript is an easy to learn scripting language, developed by Netscape to make web sites more interactive. It was first incorporated in Netscape Navigator 2.0 beta with the name of LiveScript and has undergone revisions many times since then.

Intended Audience

JavaScript enables Web pages to be interactive and intelligent, and can add excitement to an otherwise dreary page. Thus, learning this scripting language can benefit you in many ways; but you must have some basic concept of HTML to go any further. In the articles that will follow this one, my intended audience is people who know what tags are and how to write a simple web page using Notepad (or some other text editor). If you have never built a web page or if you have built them only using a WYSIWYG editor (like MS FrontPage Express), you are in the wrong place. Otherwise, welcome abroad!

JavaScript – You mean Java?

No. JavaScript and Java are two entirely different things. JavaScript is not a programming language. Because its a very simple scripting language, it cannot be used to write complex programs (like graph plotters, email clients, word processors, etc). Thus, having a background in programming is helpful but not necessary. On the other hand, Java is a platform independent object oriented programming language capable of doing anything.

What you can do with it:

Every language has a role to play. The role of JavaScript is to provide a simple tool that extends the functionality of HTML. The complex tasks are left to plug-ins and Java applets. JavaScript make a web page interactive. A web page is said to be interactive when it responds to events generated by the user or other objects. “Events” is a very broad term – ranging from simple mouse movement to clicking on a link. Some examples of JavaScript functionality are
  • JavaScript can be used to add a bit of life to a Web page by making some of the text dynamic. As a simple example, you could display an appropriate greeting-“good morning” or “good evening”, depending on the time.
  • You could have a background on/off button to control the display of the background.
  • You can change GIF and JPEG images automatically, at specified time intervals, or when a user moves the mouse over the image.
  • It enables HTML documents to respond to local events such as choosing user alternatives, sorting a table, etc.
 

What JavaScript is not meant for:

As mentioned previously, JavaScript is a scripting language and not a full-blown, object-oriented programming language. JavaScript was not designed to build complex applications.

Software needed to write JavaScript scripts

JavaScript scripts are embedded in an HTML file, which means that you can write JavaScript enabled web pages without using anything other than a simple text editor. There are some good JavaScript editors on the Internet, however. Do a search if you are interested in them.

A Simple Example

Here, I will stop for a moment and give you a simple example to show how a web page can include JavaScript. The part that is enclosed inside and is JavaScript:
<html>
<head>
<title>Simple JavaScript Example</title>
</head>
<body>

document.write ("Welcome to the world of JavaScript");

</body>
</html>
Summary JavaScript is an easy, yet powerful scripting language that enables Web page developers to write dynamic interactive web pages. Although its syntax is like Java, both are two different things. Instead of being stored as a separate file JavaScript code is included as part of a standard HTML document, just like any other HTML tags and elements. In addition, JavaScript scripts are run by the Web browser itself.