HTML scripting


The W3C HTML standard includes support for client-side scripting.
It defines how locally executable scripts may be used in a web page.
A particular client-side application, such as a web browser, may support several script languages.
Script code may be executed as the document loads or at a later time.
Script code can be written directly in the HTML document inside:

Intrinsic event attributes

s occur for different elements of a web-page:
Script code may be associated with an event and element by writing code in an HTML attribute. The name of the attribute must be that of a supported intrinsic event for the element. The script is executed whenever the event occurs for that element. These scripts are mostly JavaScript. The HTML intrinsic event model consist of the following events:
Some browsers support additional event attributes, such as:
supported a feature called "JavaScript entities" or "script macros" by which script code could be included in HTML attribute values, using a syntax similar to that of character entity references. For example, the code <img width="&;" src="foo.jpg"> calls the JavaScript prompt function to ask the user how wide the image should be.
The reserves a syntax for the "future support of script macros" in HTML attributes, but they have not been incorporated into later standards and are not supported by any current browser. A polyfill has been created in order to allow "script macros" in browsers that do not natively support this feature.