Javascript Syntex


We know that JavaScript is client side scripting language. Now question arise that how to write JavaScript code and what is the syntex for the javascript.

JavaScript is implemented by JavaScript statements which are placed within the <script> </script>  HTML tags.


We can put JavaScript anywhere in the webpage but it is recomended that we should keep it within HTML <head> tags.

<script> tag alerts the browser that the text between script tags is JavaScript code.



JavaScript Syntax:


-----------------------------------------------------------------------

<script language="javascript" type="text/javascript"> 


      JavaScript code Appere Here



</script> 


-----------------------------------------------------------------------


As stated above, script tag is consist of 2 important attributs.



  • Language 
                The language attribute specifies that which scripting language you are using and it's value will be 'javascript'.

                Although recent HTML versions have phased out this attribute.

  • Type
              The type attribute indicates that which scripting language is in use and for javascript the value of type attribute will be "text/javascript".

Comments