Javascript Introduction


Javascript is programming language that makes HTML web pages interactive.

    Importance of javascript:

  • Javascript can chage the HTML content.
  • Javascript can make HTML pages interactive.
  • Javascript tells the browser what to do when certain item is selected.
  • Almost all the modern websites use javascript.

Examples:

Changing HTML documents using javascript

<!DOCTYPE html>
<html>
<head>
<title>
JAVASCRIPT INTRODUCTION
</title>
</head>
<body>
<p id="javascript">This is example of javascript.</p>
<button type="button" onclick="document.getElement
ById('javascript').
innerHTML='This text
will appear after clicking button.'">
Button</button>
</body>
</html>

Output:

This is example of javascript.

Advantages of javascript

  • Less load in server-In javascript user input can be validated immediately after data is enetered due to which less load is given n server.
  • Immediate response-Javascript automatically validates form inputs and suggests users what type of data is to be enetered.
  • Interaction--Special effects like drag and drop can be added much more efficiently using javascript.