Home page » Web help » Html help » Html script

Html script

The tags tell the browser to expect a script in between them. You specify the language using the type attribute. The most popular scripting language on the web is JavaScript.
Adding a Script:

You can specify whether to make a script run automatically (as soonas the page loads), or after the user has done something (like click ona link).
In either case, a generally accepted convention is to place your scripts between the tags. This ensures that the script is ready to run when it is called.
HTML Code:

alert("I am a script. I ran first!")

This would open a JavaScript alert as soon as the page loads.
Triggering a Script:

In many cases, you won't want the script to run automatically. Youmight only want the script to run if the user does something (likehover over a link), or once the page has finished loading.

These actions are called intrinsic events (events for short). There are 18 pre-defined intrinsic events that can trigger a script to run. You use event handlers to tell the browser which event should trigger which script. These are specified as an  attribute within the HTML tag.

Lets say you want a message to display in the status bar wheneverthe user hovers over a link. The act of hovering over the link is anevent which is handled by the onmouseover event handler. You add the onmouseover attribute to the HTML tag to tell the browserwhat to do next. 



Comments

No comments yet. Be first!

Your comment:
Name*:
Comment*:
(refresh this page if you can't read exact code above)
Security code*:
* - compulsory fields !


Friends