<SCRIPT EVENT="..."> (HTML Tag Attribute)

A tag attribute to associate a script block with an event to be handled.


JScript - 3.0
Internet Explorer - 4.0

This HTML tag attribute is quite useful when using ActiveX controls in web pages. You can use this to attach a fragment of script to an event so that the screen gets updated.

Here is a skeleton of some HTML that attaches a script to an object that has been embedded:

<SCRIPT FOR="Xbutton" EVENT="Click()">

// Do some kind of stuff in here as a

// result of the ActiveX calling this


<OBJECT ID="Xbutton" CLASSID="..." CODEBASE="..." STYLE="...">

<PARAM NAME="..." VALUE="...">


The CLASSID, CODEBASE, and other parameters depend on the ActiveX control you are embedding. The point to make here is that as the page is loaded, the control will be displayed and when the user clicks on it, the browser makes the association by mapping the FOR="..." HTML tag attribute in the <SCRIPT> tag to the ID="..." attribute of the <OBJECT> tag. Then the event that the control triggers is mapped to the EVENT="..." HTML tag attribute of the <SCRIPT> tag.

You can create a whole set of <SCRIPT> blocks, one for each event and control you expect to use. This means the browser does the mapping and dispatching of events for you.

See also:<SCRIPT>, Event handler in <SCRIPT>, Script execution