Showing posts with label scripting language. Show all posts
Showing posts with label scripting language. Show all posts

Monday 22 February 2016

Javascript introduction

Javascript is an object based scripting language. Javascript is lightweight and cross platform.It is a programming language for HTML and web.














JavaScript is used to create interactive websites. It is mainly used for:
  • Client-side validation
  • Dynamic drop-down menus
  • Displaying data and time
  • Displaying popup windows and dialog boxes etc

Basically JS can change the HTML content and below is one example.

document.getElementById("example").innerHTML = "Hello JavaScript";

This example uses the method to "find" an HTML element (with id="example"), and changes the element content (innerHTML) to "Hello JavaScript"

Javascript Example:


<h2>Welcome to JavaScript</h2>  
<script>  
document.write("Hello JavaScript - First example");  
</script> 

Output:

Hello JavaScript - First example