JAVASCRIPT
  • JavaScript Introduction
  • JavaScript Accessing Elements
  • JavaScript Responding to Click
  • JavaScipr Style Manipulation
  • JavaScript Variables , Arrays and Loops
  • JavaScript Functions

JavaScript Introduction



JavaScript is the world's most popular programming language.JavaScript is the programming language of the Web.JavaScript is easy to learn.JavaScript is a lightweight, cross-platform and interpreted scripting language. It is well-known for the development of web pages, many non-browser environments also use it. JavaScript can be used for Client-side developments as well as Server-side developments

There are different ways of implementing javascript in our web page which are listed below :

Inline Javascript

It is just similar to inline css.

<button onclick="alert('wellcome everyone!!')">Click.!! </button>

 

Internal Javascript

The javascript code can also be written on same page of a html file using the script tag basic syntax of writting it show below

<script type="text/javascript">
   alert("hello...");
   function show()
   {
      alert("wellcome everyone");
   }
</script>

use of semicolon (;) is must

External Javascript

The javascript code are written in some other file with extension .js and the .jsfile is included in the html file using a simple code

In .html file you should use the code below
note : put directory and file name accordingly

Syntax :
<script src="__directory/file-name.js> </script>

Example :                   

<script src="js/index.js> </script>

The index.js file will look like this

alert("hello...");
function show()
{
alert("wellcome everyone");
}