Friday, 25 August 2017

JavaScript Syntax - W3Tricks

JavaScript - Syntax


  • JavaScript is most stop implement with HTML.
  • JavaScript is generally set on inside of head tag ' <head> ' .
  • But JavaScript is used inside any tag off HTML.
  • JavaScript is start ' &ltscript&gt ' and end with ' &lt/script&gt ' .

Syntax

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

Attributes of Script Tag

  • Two Main Important Attributes of Script Tag in HTML
  • Language - Scripting Language You Are Using
  • Type - what is now recommended to indicate the scripting language.

External File JavaScript

  • Also, javascript is write in a separate file to use multiple HTML pages.
  • A file extension is ' .js ' .

Syntax

<script language="javascript" type="text/javascript" src="script.js"></script>
  • src - src - is used to set JavaScript file path.

0 comments:

Post a Comment