|
To access the contents, click the chapter and section titles.
HTML 4.0 Sourcebook
Problems with OBJECT-Based Data References Figures 7.19 through 7.21 illustrate some of the problems with OBJECT-based data embedding, as currently implemented. Indeed, these problems are so severe that OBJECT-based data embedding should, for the most part, be avoided. The main problems are:
Additional problems appear when other data are referenced from OBJECTrecall that OBJECT can in principle reference any types of data, not just images or HTML documents. For example, the markup: <OBJECT DATA=sound.au HEIGHT=60 WIDTH=160> <P>Audio recording of <A HREF=sound.au>Marc Andreesen</A></P> </OBJECT> references an audio file. Both Internet Explorer 4 and Netscape Navigator 4 come with plugin modules capable of playing this type of audio file, so that this should work. Indeed, Netscape Navigator understands this markup and displays a control panel for playing the audio file. Internet Explorer 4, however, crashes whenever it tries to load the fileand on occasion, completely crashes the Windows 95 operating system! Imagemaps and OBJECT-Embedded ImagesSince OBJECT elements can embed images, it is important that these images can be imagemapped in the same manner as IMG elements. Indeed, the OBJECT specification supports two mechanisms for imagemapping embedded objects, outlined in the following sections. Note, however, that OBJECT does not support server-side imagemaps, only client-side onesif you want server-side imagemaps, you must use IMG elements or form INPUT elements of TYPE=image.
OBJECT Imagemaps (1)The SHAPES Attribute The recommended form for adding imagemaps to OBJECT-embedded images makes use of a proposed extension to the anchor element. An example of this is shown in the HTML document listed in Figure 7.22the attributes associated with the imagemap are shown in boldface. As with IMG, the ALIGN attribute specifies the desired alignment for the displayed object (the image). The SHAPES attribute tells the browser that this object is an imagemapas a result, the browser looks, within the HTML markup inside the Figure 7.18 Document illustrating the use of OBJECT to embed data. Browser renderings of this document are found in Figures 7.19, 7.20, and 7.21. <HTML> <HEAD> <TITLE>Test of OBJECT-based DATA Inclusions</TITLE> </HEAD><BODY BGCOLOR=#ffffff> <P><B>OBJECT 1 (.gif inside .tiff) </B><BR> <OBJECT HEIGHT=25 WIDTH=100 DATA=button.tif TYPE=image/tiff> <OBJECT HEIGHT=25 WIDTH=100 DATA=button.gif TYPE=image/gif> <IMG SRC=button.gif> </OBJECT> </OBJECT> <P><B>OBJECT 2 (.html)</B><BR> <OBJECT HEIGHT=100 WIDTH=300 DATA=demo.html TYPE=text/html> <IFRAME SRC=demo.html HEIGHT=100 WIDTH=300> <P>Alternative text for browsers that don't support <B>OBJECT</B> inclusion of HTML, or <B>IFRAME</B>.</P> </IFRAME> </OBJECT> </BODY></HTML> OBJECT, for anchor elements containing the SHAPE and COORDS attributesthese contain the map coordinate information. If a browser does not support OBJECT, the user then sees the enclosed list of hypertext anchors as regular HTML markup. Thus the approach provides fully functional links or imagemaps, regardless of the browsers capabilities.
A Elements Inside an OBJECT As noted, A elements within an OBJECT support two new attributes relating the anchor reference to regions within the OBJECT-referenced image. The attributes and their meanings are:
Figure 7.22 Client-side imagemaps using OBJECT and special A element attributes. <OBJECT DATA=activeimage.gif SHAPES ALIGN=left HEIGHT=200 WIDTH=180> <A HREF=intro.html SHAPE=rect COORDS=20,20,60,40>Introduction</A> | <A HREF=welcome.html SHAPE="circle" COORDS="70,70,10">Welcome</A> | <A HREF="blobby.html" SHAPE="poly" COORDS="100,100, 100,110, 110, 120, 90, 130">Visit Mr. Blobby!</A> | <A HREF="help.html" SHAPE="default">Help</A> </OBJECT> The following table describes appropriate COORDS values for the different SHAPEs.
OBJECT Imagemaps (2)The USEMAP Attribute For compatibility with the MAP element approach to client-side imagemaps (see Chapter 6), OBJECT also supports a USEMAP attribute, equivalent to the USEMAP attribute of the IMG element. Figure 7.23 shows a USEMAP equivalent to the client-side imagemap first given in Figure 7.22once again, the attributes associated with the imagemap are highlighted in boldface. Although similar to the approach described in the previous section, this method does not provide a simple HTML text alternative for browsers that do not support OBJECT.
|
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. |