Event handler in <SCRIPT> (Definition)

You can associate an event handler using the <SCRIPT> tag's attributes.

HTML syntax:<SCRIPT FOR="aName" EVENT="anEvent">
Argument list:aNameThe name of an <INPUT> element
anEventThe name of an event to be handled

In MSIE, you can give each <INPUT> tag a NAME attribute.

This can then be used to map a <SCRIPT> block to that <INPUT> object. The <SCRIPT> block is further mapped to the event names that the <INPUT> block might generate trigger events for. You end up with one <SCRIPT> block per event per named <INPUT> object.

The upside of this is that you don't have complicated function name mappings, but the downside is that you can end up with a large number of discrete <SCRIPT> blocks.

Internally, MSIE has to be turning these into some kind of function object otherwise they would be interpreted as inline Global code.


See also:<SCRIPT EVENT="...">, Element.onevent, Script execution