HTML Script Tags

Ratings:
(4)
Views: 672
Banner-Img
Share this blog:

HTML Script Tag

A script is a small piece of program that can add interactivity to your website. For example, a script could generate a pop-up alert box message, or provide a dropdown menu. This script could be Javascript or VBScript. You can write your Event Handlers using any of the scripting language and then you can trigger those functions using HTML attributes.

External Script

If you have to use a single script functionality among many HTML pages then it is a good idea to keep that function in a single script file and then include this file in all the HTML pages. You can incluse a style sheet file into HTML document using <script> element. Below is an example. <head> <script src=”yourfile.js” type=”text/javascript” /> </head>

Internal Script

You can write your script code directly into your HTML document. Usually we keep script code in header of the document using <script> tag. otherwise there is no restriction and you can put your source code anywhere in the document. You can specify where to make a script run automatically(as soon as the page loads), or after he user has done something(like click on a link). Below is an example this would write a Hello Javascript! message as soon as the page loads: <head> <title> internal script></title> </head> <body> <script type=”text/javascript”> alert(“Hello Javascript!”) </script> </body> This will produce following result : Hello Javascript!

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox