RECOMMENDED POST: Html Introduction
Various functions known as event handlers can be written in your code, using any of the scripting language and then trigger those functions using Html attributes.
RECOMMENDED: Html Elements
Now let us make use of the above external Js file in our following Html document:
You can write your scripting code directly into your Html document. Usually we keep scripting code in the header of the Html document using the <script> tag, otherwise there is no restriction at all and you can put your source code any where in the Html document but inside <script> tag.
RECOMMENDED: Html Attributes
You can try the above codes out for better understanding and feel free to drop your questions in the comment box.
The event handlers are nothing but simply defined functions that can be called against a mouse or the keyboard event. Your business logic can be defined inside your event handler which can vary from a single to 1000s of line code.
Following example below explains how to write an event handler. Let us now write one simple function EventHandler() in the header of the document. We are going to call this function when a user brings a mouse over a paragraph
Hide Scripts from Older Browsers
RECOMMENDED: Html Attribute 2
The <noscript> Element
You can also provide alternative info to the users whose browsers don't support scripts and for those users who have disabled script option on their browsers. You can do this using the <noscript> tag.
Default Scripting Language
There may be a situation when you would include multiple script files and utimately using multiple <script> tags. You can then specify a default scripting language for all your script tags.
This saves you from specifying the language every time you use a script tag within the page.
Note - You can still override the default language by specifying a language within the script tag.
Alright guy, we have come to the end of this tutorial post, see you all in my next tutorial, don't forget to subscribe with us, bye for now.