Tuesday, March 27, 2012

HTML object

html object

HTML object

In the early days of www, HTML pages are displayed as text. Then came the pictures, thus enhance the presentation site. But now, we can include many more objects than pictures: sounds, Java applets, video clips, Flash animations ... Almost anything is possible. Almost all? And yes, because in this area, browsers do not do as they please. It seems that the W3C WARRANTY were not all followed in their entirety. To include an item in a page, use the tag like <OBJECT> container. The following example is intended to display an image the same way with the tag <IMG> . It is quite another ...



 <OBJECT Data="../../images/abc.gif" type="image/gif" width="520" height="95">
 Since browsers are almost ALL incomptétents with
 this tag, you should see this text
 </ OBJECT>
Since browsers are almost ALL incomptétents with this tag, you should see this text If you are running Netscape Navigator, you certainly do not see anything. If you're running Microsoft Internet Explorer, you normally distinguish a kind of image in a <IFRAME> . Luckily he left <IMG> . Detail but rather the code. The HTML content in the tag <OBJECT> is intended to be displayed if the browser be unable to use the object. The data attribute represents the URL of the resource to use. Type corespond to the MIME type. MIME means Multipurpose Internet Mail Extensions. This lets the browser know what type of object: if a picture, video, sound ... In our case, it is a picture gif . See the following table to know the MIME type to use depending on the subject to include:
MIME types
MIME type File type
application / excel Microsoft Excel Document
application / msword Microsoft Word document
application / pdf Acrobat Reader file
application / rtf RTF document
application / zip ZIP
audio / midi Audio MIDI file
audio / mpeg MP3 Audio File Type
audio / x-aiff AIFF audio file
audio / x-pn-realaudio RealAudio sound file
image / bmp Bitmap Image
image / jpeg JPEG image
image / png PNG
image / tiff TIFF image
multipart / x-zip Archive
text / html HTML document
text / plain Plain Text
video / mpeg MPEG video
video / quicktime QuickTime Video
video / x-msvideo AVI video type
video / x-sgi-movie Video type MOVIE
This table is of course far from complete. It NCLUSION however the most common types. It may thus include a large number of media, such as clips or sounds: just know the appropriate MIME type. The width and height attributes specify the dimensions that must occupy the object, in pixels. Here are the other possible attributes:
  • align defines the horizontal or vertical alignment of the object. Values ​​can be left, center or right to the horizontal, or top, middle or bottom for vertical.
  • standby displays a text during loading of the object.
  • code specifies the URL of a class for Java applets.
To include an applet in a page, you can use the tag <OBJECT> instead of the tag <APPLET> :
 <OBJECT Code="NervousText.class" width="180" height="60">
 <PARAM Name="text" value="Cyb Warrior">
 </ OBJECT>
The <PARAM> tag is not limited only to the applet. It allows to pass parameters to the object and is also used with Flash animations. The tag <PARAM> can take the following attributes:
  • name defines the parameter name. In our example, text
  • value is the value of this parameter. Here is Cyb Warrior
  • valuetype defines the type of the value of value. It can take two values:
    • data: this is the default (which is why we have deliberately omitted in our example). The value is treated as a given.
    • ref: The value then points to an outside resource (in the case of an image, for example).

0 comments:

Post a Comment