JavaScript in HTML

JavaScript is a java piece of code which is employed to perform an action. Using which can write different functionality, event handlers

JavaScript file can be kept separately in a file which will be included when it is needed .

Internal JavaScript

Here script is written openly on a HTML document. It can be kept in the header section of the document using <script> tag or also it can be kept anywhere in the document


JavaScript in HTML Assignment Help Through Online Tutoring and Guided Sessions at MyAssignmentHelp

javascript in html img1


javascript in html img2

External JavaScript

Here script is written separately as a javascript file and then it is included on a HTML document. The java script file will have an extension .js and it is added in HTML files using <script> tag


script .js file
function Hell()
alert (“Hello”);


javascript in html img3


javascript in html img4

Event Handlers in JavaScript

It is a functionality which is invoked against any keyboard or mouse event.

The business logic definition can be defined in the event handler


javascript in html img5


javascript in html img6

Default Scripting Language

It is possible to add multiple script files using multiple <script> tags. It is possible to specify default scripting language to the <script> tags


<meta http-equiv = “Content-Script-Type” Content = “text/ JavaScript” / >