Click Here!
home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

Platinum Edition Using HTML 4, XML, and Java 1.2
(Publisher: Macmillan Computer Publishing)
Author(s): Eric Ladd
ISBN: 078971759x
Publication Date: 11/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


Table 3.2 details the event handlers available under HTML 4.0. Most can be used within any HTML element, but a few are limited to specific elements. These special cases are noted in the table.

Table 3.2 HTML 4.0 Event Handlers

Event Handler Triggered when...

onload A document or frameset is loaded; only allowed in the <BODY> and <FRAMESET> elements
onunload A document or frameset is unloaded; only allowed in the <BODY> and <FRAMESET> elements
onclick The mouse button is clicked once
ondblclick The mouse button is clicked twice
onmousedown The mouse button is depressed
onmouseup The mouse button is released
onmouseover The mouse pointer is over a page element
onmousemove The mouse pointer is moved while over a page element
onmouseout The mouse pointer is moved off a page element
onfocus A form field receives focus by tabbing to it or by clicking it with the mouse pointer; only allowed in the <INPUT>, <SELECT>, <TEXTAREA>, <LABEL>, and <BUTTON> elements
onblur A form field loses focus by tabbing out of it or by clicking a different field with the mouse pointer; only allowed in the <INPUT>, <SELECT>, <TEXTAREA>, <LABEL>, and <BUTTON> elements
onkeypress A key is pressed and released over a page element
onkeydown A key is pressed over a page element
onkeyup A key is released over a page element
onsubmit A form is submitted; only allowed in the <FORM> tag
onreset A form is reset; only allowed in the <FORM> tag
onselect A user selects some text in a text field; only allowed in the <INPUT> and <TEXTAREA> elements
onchange A form field loses focus and its value has changed since gaining focus; only allowed in the <INPUT>, <TEXTAREA>, and <SELECT> elements

Document Structure Tags

Every HTML document has three major components: the HTML declaration, the head, and the body. The document structure tags are those that define each component.

<HTML>

Type:

Container

Function:

Declares the document to be an HTML document. All document content and supporting HTML code goes between the <HTML> and </HTML> tags.

Syntax:

<HTML> ... </HTML>

Attributes:

Technically speaking, the <HTML> tag can take the VERSION attribute, but this has been deprecated in favor of version information being specified in the <!DOCTYPE> tag (see “Related Tags” below).

Example:

<HTML>
... all content and HTML code goes here ...
</HTML>

Related Tags:

Although the <HTML> tag is typically the first tag in a document, it is sometimes preceded by a <!DOCTYPE> tag that specifies what level of HTML conformance the document displays. A document conforming to the HTML 4.0 standard might have a <!DOCTYPE> tag that reads:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0//EN”>

Technically, <!DOCTYPE> is an SGML tag, not an HTML tag, so it is acceptable for it to be outside the <HTML> and </HTML> tags.

<HEAD>

Type:

Container

Function:

Contains the tags that compose the document head.

Syntax:

<HEAD> ... </HEAD>

Attributes:

<HEAD> can take the PROFILE attribute, which gets set equal to a space-separated list of URLs that point to meta data profiles for the document.

Example:

<HTML>
<HEAD PROFILE=”<http://www.server.com/profiles/”>>
... tags making up the document head go here ...
</HEAD>
... all other content and HTML code goes here ...
</HTML>

Related Tags:

A number of tags can be placed between the <HEAD> and </HEAD> tags, including <BASE>, <ISINDEX>, <LINK>, <META>, <SCRIPT>, <STYLE>, and <TITLE>. Each of these is described next.

<BASE>

Type:

Standalone

Function:

Declares global reference values for the HREF and TARGET attributes. The reference or base HREF value is used as a basis for computing all relative URL references. The base TARGET name is used to identify the frame into which all linked documents should be loaded.

Syntax:

<BASE HREF=”base_url”>

or

<BASE TARGET=”frame_name”>

Attributes:

The <BASE> tag takes either the HREF or the TARGET attribute. A given <BASE> tag can contain only one of these, so if you need to specify a base URL and a base target frame, you need to have two <BASE> tags in the head of your document. These two attributes work as follows:

  HREF—Specifies the reference URL that is used to help compute relative URLs. If the BASE HREF URL is http://www.myserver.com/sports/hockey/skates.html and you use the relative URL pucks.html elsewhere in the document, for example, the relative URL will really point to http://www.myserver.com/sports/hockey/pucks.html.
  TARGET—Specifies the default frame name to which all links are targeted.


NOTE:  When used in a <BASE> tag, HREF is typically set to the URL of the document.

Example:

<HEAD>
<BASE HREF=”http://www.myserver.com/index.html”>
<BASE TARGET=”bigframe”>
...
</HEAD>


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.