Writing Event Handler

It is very easy to write an even handler. Following example explains how to write an event handler. Let’s write one simple function myalert in the header of the document. We will call this function when any user will bring mouse over a paragraph written in the example :


<title> Event Handler Example t</title>

<script type=”text/javascript”>

function myalert()


alert(“I am an event handler……”);






<span onmouseover-“myAlert();”>

Bring your mouse here to see an alert



Now this will produce following result. Bring your mouse over this line and see the result :

Bring your mouse here to see an alert

The <noscript > Element

You can also provide alternative info for users whose browsers don’t support scripts and for users who have disabled scripts. You do this using the <noscript> tag.


Please enable javascript



Default Scripting Language

You can specify a default scripting language for all your scripting tags to use. This saves you from having to specify the language everytime you use a script tag within the page. Below is the example :

<meta http-equiv=”Content-Script-Type” content=”text/Javascript”>


HTML Meta Tag

HTMl lets you specify metadata-information about a document rather than document content-in a variety of ways. The META element can be used to include name/value pairs describing properties of the HTML document, such as author, Expiry Date, a list of key words, author etc.

Metadata provided by using meta tag is a very important part of the web. It can assist search engines in finding the best match when a user performs a search. Search engines will often look at any metadata attached to a page especially keywords- and rank it higher than another page  with less relevant metadata, or with no metadata at all.


Adding Meta Tags to your Documents

You can add metadata to your web pages by placing <meta> tags between the <head> and </head>tags. The can include the following attributes

Attribute                                         Description
NameName for the property, can be anything, Examples include, keywords, description, author, revised, generation etc.
ContentSpecifies the property’s values
SchemeSpecifies a scheme to use to interpret the property’s value(as declared in the content attribute)
http-equivUsed for http response message headers. For example http-equiv can be used to refresh the page or to set a cookie. Value include content-type,expires,refresh and set-cookie



Core attributes for all the elements are discussed in next chapter.

Meta Tag Examples

Let’s see few important usage of Meta Tags.

Specifying Keywords

We specify keywords which will be used by the search engine to search a web page. So using following tag you can specify important keywords related to your page.


<meta name=”keywords” content=”HTML, meta tags, metadata”/>