SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 HTML Online

HTML Tables

Form Elements

Images and Objects
  Images
  Objects

Frames & Framesets

 


Sponsored Links

HTML Object Element

The HTML 4.0 <OBJECT> element is designed for extending HTML. The <OBJECT> element allows an author to download external data or programs into the current page. This element can be used to download Java Applet's, ActiveX controls, Scriptlets, or other types of information. The long-term goal for the <OBJECT> element is to replace the <APPLET> and <IMG> element with a single way to embed data.

Part of the design goals of the <OBJECT> element is to ensure that it graceful degrades in browsers that do not support the element or possibly the object type or data. When a browser does not support the <OBJECT> element or a particular use of the element, the contents within the element are to be displayed. For example:

  <OBJECT TYPE="text/mythical" 
          DATA="myFile.scott" 
          WIDTH=100 
          HEIGHT=100>
    <DIV STYLE="border: 1pt black solid; 
                font: 8pt arial; width: 100; height: 100">
      You either do not support the mythical file type or 
      the object tag.
    </DIV>
  </OBJECT>
You either do not support the mythical file type or the object tag.

In the above example, we defined an OBJECT element that would manipulate the data, codeFile.scott, assuming the browser supported that particular format. Since the browser does not recognize this mime type, the contents within the object element are displayed. The contents within the <OBJECT> element can be any HTML, but at minimum, you should provide an explanation of what the user should have seen.

When the object element works correctly, it can run an applet or control, or display a specific file type. The object below displays our home page. This object is defined as follows:

  <OBJECT TYPE="text/html" DATA="/home.asp" 
          WIDTH=450 HEIGHT=350>
    <P>You should be seeing 
    <A HREF="http://www.SiteExperts.com">SiteExpert's</A> 
    home page.
  </OBJECT>

You should be seeing SiteExpert's home page. If you are seeing this text, your browser does not support the object element or the ability to display HTML document's as objects.

If you are familiar with the <IFRAME> element, the above use of <OBJECT> should look very similar. The single difference is that the <OBJECT> element cannot navigate indepedently from the containing document. This means that clicking on a link in the <OBJECT> always replaced the entire document, while with an <IFRAME> it is possible to have a a document navigate and appear within the same <IFRAME> element.

Frames & Framesets...

Copyright © 1997-2008 InsideDHTML.com, LLC. All rights reserved.