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
Example
JavaScript in HTML Assignment Help Through Online Tutoring and Guided Sessions at MyAssignmentHelp
![Javascript In HTML javascript in html img1](https://www.assignmenthelp.net/webimg/ahp/html-assignment-help/javascript-in-html-img1.jpg)
Output
![Javascript In HTML javascript in html img2](https://www.assignmenthelp.net/webimg/ahp/html-assignment-help/javascript-in-html-img2.jpg)
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
Example
{` script .js file function Hell() { alert (“Hello”); } `}
HTML File
![Javascript In HTML javascript in html img3](https://www.assignmenthelp.net/webimg/ahp/html-assignment-help/javascript-in-html-img3.jpg)
Output
![Javascript In HTML javascript in html img4](https://www.assignmenthelp.net/webimg/ahp/html-assignment-help/javascript-in-html-img4.jpg)
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
Example
![Javascript In HTML javascript in html img5](https://www.assignmenthelp.net/webimg/ahp/html-assignment-help/javascript-in-html-img5.jpg)
Output
![Javascript In HTML javascript in html img6](https://www.assignmenthelp.net/webimg/ahp/html-assignment-help/javascript-in-html-img6.jpg)
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
Example
<meta http-equiv = “Content-Script-Type” Content = “text/ JavaScript” / >