HTML scripting

HTML scripting

HTML Series

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:
* SCRIPT elements
* Intrinsic event attributes

cript macros

The SCRIPT element type

SCRIPT elements may occur zero or more times within the HEAD and BODY elements. Scripts within script elements are processed as the document loads.

Intrinsic event attributes

Events occur for different elements of a web-page:
* Documents (BODY and FRAMESET)
* Forms
* UI elements (Anchor, Control Element, Image)

Script code may be associated with an event and element by writing codein an HTML attribute.The name of the attribute must be that of a supported intrinsic eventfor the element (for example, "onLoad").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:

*Document
**onLoad
**onUnload
*Form
**onSubmit
**onReset
*Document and UI elements
**Focus
***onFocus
***onBlur
*UI elements
**Mouse
***Movement
****onMouseOver
****onMouseOut
****onMouseMove
***Button
****onClick
****onDblClick
****onMouseDown
****onMouseUp
**Keyboard
***onKeyPress
***onKeyDown
***onKeyUp
**Other (TEXT/TEXTAREA)
***Lost focus with modified content
****onChange (also OPTION)
***Text selection
****OnSelect

Some browsers support additional event attributes (outside the standard), such as:
*onResize
*onMove
*onScroll
*onAbort

Script macros

Netscape Navigator 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="&{prompt('Width?')};" src="foo.jpg"> calls the JavaScript prompt() function to ask the user how wide the image should be.

The [http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.7.1 HTML 4.01 specification] 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.


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Scripting for the Java Platform — is a framework for embedding scripts into Java source code. The target platform is the same as that of Java servlets, specifically Java Platform, Enterprise Edition 1.4. Java SE 6 includes a JavaScript engine based on Rhino JavaScript for Java… …   Wikipedia

  • HTML — For the use of HTML on Wikipedia, see Help:HTML in wikitext. HTML (HyperText Markup Language) Filename extension .html, .htm Internet media type text/html Type code TEXT …   Wikipedia

  • HTML element — This article is about the HTML elements in general. For information on how to format Wikipedia entries, see Help:Wiki markup and Help:HTML in wikitext HTML HTML and HTML5 Dynamic HTML XHTML XHTML Mobile Profile and C HTML Canvas element Character …   Wikipedia

  • Scripting language — Scripting redirects here. For other uses, see Script. A scripting language, script language, or extension language is a programming language that allows control of one or more applications. Scripts are distinct from the core code of the… …   Wikipedia

  • HTML Application — (HTA) Filename extension .hta Magic number %hta Developed by Microsoft Website http://msdn.microsoft.com/en us/library/ms536471(VS.85).aspx An …   Wikipedia

  • HTML — (HyperText Markup Language) Desarrollador World Wide Web Consortium WHATWG Información general …   Wikipedia Español

  • HTML 5 — Saltar a navegación, búsqueda HTML5 (Hypertext Markup Language) Desarrollador W3C HTML WG, WHATWG Información general Extensión de archivo …   Wikipedia Español

  • Html Viewer 3 — в ОС Ubuntu 8.04 Тип Браузер …   Википедия

  • Dynamic HTML — HTML HTML and HTML5 Dynamic HTML XHTML XHTML Mobile Profile and C HTML Canvas element Character encodings Document Object Model Font family HTML editor HTML element HTML Frames HTML5 video …   Wikipedia

  • HTML 5 — Infobox file format name = HTML (HyperText Markup Language) icon = extension = .html, .htm mime = text/html type code = TEXT uniform type = public.html owner = World Wide Web Consortium genre = Markup language container for = contained by =… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”