Introduction to JavaScript



JavaScript was designed to add interactivity to HTML pages.

It is a scripting language.

A scripting language is a lightweight programming language.

A JavaScript consists of lines of executable computer code.

It is usually embedded directly into HTML pages.

It is an interpreted language (means that scripts execute without preliminary compilation).

Everyone can use JavaScript without purchasing a license.

What a JavaScript Can do?

It gives HTML designers a programming tool.
It can put dynamic text into an HTML page.
It can react to events.
It can read and write HTML elements.
It can be used to validate data.
It can be used to detect the visitor’s browser.
It can be used to create cookies.

How to put it?

<HTML>.
<BODY>
<SCRIPT TYPE=”text/javascript”>
Document.write(“Hello World !”)
</SCRIPT>
</BODY>
</HTML>

 Objects, Properties, and Methods in JavaScript

Each object has certain properties and methods associated with it. Properties are things that describe the object, and they include sub–object. For example, if a person is considered to be an object, then hair color, height, etc. are its properties or sub-objects. 

Methods are things that the object can do or things that can be done to the object. One method associated with the document object is write(). For example, the document.write() method writes HTML to a Web page. The argument to be passed to write() method is a string of text that will be written. For example, document.write(“Hello World!”).

 JavaScript Object Model

There are several objects supported by JavaScript. Some of these are explained as follows:

Post a Comment

Previous Post Next Post