|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
ACCESSKEY Attribute (Internet Explorer 4 Only) ACCESSKEY, valid with the elements A, AREA, BUTTON, LABEL, INPUT, and LEGEND, defines a single-character keyboard shortcut for accessing these elements. The attribute value must be a single character available on the keyboard, for example ACCESSKEY=q. Since ACCESSKEY binds a specific character to a specific element, the values for the ACCESSKEY must be unique within a given documentno two elements should have the same value. The manner in which keys are accessed varies from computer to computer. On Microsoft Windows platforms, the keys are accessed using the sequence ALT-char (ALT here means the keyboard ALT key), where char is the access key value: For example, a user would type ALT-q to access the element with attribute ACCESSKEY=q. Macintoshes in general use the sequence CMD-char, where CMD is the command key. Typing the access key sequence on a browser will activate the referenced element, where possible. For example, if the referenced item is a checkbox, button, or radio button, accessing the item will cause it to be toggled or pressed; if it is a hypertext anchor, accessing the item will access the hypertext reference. However, when an access key references an item that requires editing (such as a reference to a LABEL that labels a TEXTAREA), the access key sequence simply moves the cursor to the region to be edited. TABINDEX Attribute (Internet Explorer 4 Only) The A, AREA, BUTTON, OBJECT, INPUT, SELECT, and TEXTAREA elements also support a TABINDEX attribute, which specifies the order in which these elements should be accessed when the user viewing the document presses the tab key. The value for TABINDEX can be any positive integer, including zero. Negative values are not allowed. Elements that support TABINDEX, but that are not assigned an explicit value, are assigned a default TABINDEX value of zero. Zero is considered to be the lowest priority in the tabbing sequenceall positively indexed elements are accessed before those assigned a value of zero. Unlike the case with ACCESSKEY, using TAB to select an item does not modify or activate the itemthe user must still activate the selected item to change the value. The tabbing sequence is as follows: Starting at the top of the document, the browser first tabs through all elements assigned positive TABINDEX values, starting with the smallest non-zero integer value and working upwards. If two elements have the same integer value, they are tabbed through in the order in which they appear in the document. Note that the tabbing index values need not be consecutivea set of values such as 1, 3, 8, 25 is acceptable. Once all the positive values are completed, the browser next tabs through all elements with zero (or unassigned) values, starting at the top of the document, and working downwards. Once all these items are finished, the browser goes back to the start and recommences the sequence. Internet Explorer 4 supports TABINDEX, but Netscape Navigator 4 does not. Note that with a collection of TYPE=radio buttons that share the same NAME, TABINDEX will only select the first button in the group, and the user must use another method to navigate and choose the desired button. Embedding OBJECTs in HTMLOBJECT is designed to augment and replace the current embedding elements IMG, EMBED, and APPLET. It supports functionality similar to these elements, plus additional features not possible with any of them, as outlined below. Indeed, HTML 4 designates the APPLET element as deprecated, with the intention of using OBJECT for all object embedding in HTML. As is apparent from the content model presented later, OBJECT can contain most HTML elements. Of particular importance are PARAM elements, which specify parameters to be passed to the object when it is run, as was the case for PARAM elements inside an APPLET. Almost all other markup inside OBJECT is ignored by a browser that supports OBJECT and that supports the object being embedded. However, if a browser does not understand OBJECT or does not support the particular type of embedded object, it should take the HTML content of the element and display it instead. Thus, the content of OBJECT serves as an HTML alternative for users who are unable to view the object itself. In principle, you should be able to code documents using the OBJECT element, while including the pre-OBJECT markup inside. Thus if you already have markup using EMBED or APPLET elements, you can include these elements inside an OBJECT. Browsers that do not understand OBJECT will then, if capable, implement the EMBED or APPLET instructions. In practice, however, this does not workboth Internet Explorer and Netscape Navigator have many bugs in their OBJECT implementation, making nesting of EMBED or APPLET elements inside an OBJECT a rather risky endeavor. Some illustrations of these problems are given in the following sections. The result is that you will need to very carefully test all uses of OBJECT, to make sure that things work as you want! It is easiest to give a flavor for the OBJECT element using some simple examples, and that is the approach we shall take here. A detailed description of the OBJECT element and attributes follows this overview.
OBJECT-Based Inclusion of DataOBJECT is intended to replace three elements, EMBED, IFRAME, and IMG, which each take an external piece of data of a particular type (or types) and embed it in place within the document. However, there are many kinds of data one might wish to insert (images, video, text, HTML, PostScript, CAD files, etc.), and it is clearly impossible to create new HTML elements for each case. With OBJECT, generic external data can be included via markup such as: <OBJECT HEIGHT=100 WIDTH=100 DATA=button.tiff TYPE=image/tiff> <P><I>An image of an example button, to be used ... </P> </OBJECT> Here, the DATA attribute gives the URL of the data file, and the new TYPE attribute specifies the MIME type of the data. TYPE is optional, but is useful information that lets the browser know the type of data to expect when it retrieves the DATA. It can then, for example, choose not to retrieve the data, should it not be able to process the indicated TYPE. The HEIGHT and WIDTH attributes define the size for the displayed object. If the referenced data can be rescaled, they will be rescaled to fit the defined region. If not, then HEIGHT and WIDTH simply define the size of a window through which the underlying object is viewed. As mentioned previously, the content of OBJECT is HTML markup to be displayed by browsers that do not understand OBJECT or that are unable to display the referenced type of data (e.g., they do not have an appropriate plugin). Thus, in the preceding example, if the browser were unable to display TIFF images, it would instead display the paragraph text indicated. This latter fact allows for nested OBJECTs, with the inner OBJECT being used if the browser cannot process the outer one. For example, the preceding code could be generalized as follows: <OBJECT HEIGHT=100 WIDTH=100 DATA=button.tif TYPE=image/tiff> <OBJECT HEIGHT=100 WIDTH=100 DATA=button.gif TYPE=image/gif> <P><I>An image of an example button, to be used ... </P> </OBJECT> </OBJECT> Now if the browser cannot view TIFF images, it will process the HTML markup inside the OBJECT. But, just inside lies another OBJECT, referencing a GIF image. Then, if the browser is also unable to display the GIF image, it will bypass the second, nested object and display the HTML markup nested within. Indeed, you can place EMBED, IMG, and IFRAME elements within the OBJECT, to provide functionality for older browsers that do not support OBJECT. Such markup is illustrated in Figure 7.18, with browser renderings in Figures 7.19 (Internet Explorer 4), 7.20 (Netscape Navigator 4), and 7.21 (Netscape Navigator 3).
|
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. |