Javascript is client side language.
Basically we use javascript for validation and dynamic data change.
First of all you have to know how can we include our javascript code in our html page.
It is a good programming practice to put your javascript code in your head tag.
Now there are two ways from we can apply our javascript in our page
i) Internal
ii) External
The syntax of applying javascript internally :
<script type="text/javascript" >
// your code is here ;
</script >
Now the second one External javascript :
The syntax of External Javascript is :
<script type="text/javascript" src="path to your js file " > </script >
Here js file means :
When you want to create html file at that time you give extension to that file is .html
When you want to create php file at that time you give extension to that file is .php
So When you want to create Javascript file at that time you give extension to that file is .js
Keep in mind starting of javascript file never start with the script tag.
In short when you are going to create javascript file means js file , in that file just start to write your code .In that file no need to mention script tag.
Comments
Post a Comment