The object element is used to insert a file into the document. That file can be of any type, an image, a text file, a video or audio, or even a file written in another language such as a flash based animation.

A browser will always try to render an object element and if for some reason it cannot be done, it should try to somehow render its content.

The element as a URI source uses data or classid attributes, depending on the type of a file being inserted.

An object element can also be nested under other <object> tag or tags but in that case a browser must read the content but not render it unless the parent <object> tag cannot be executed.

The param element is always a child to an object element. It is used when there are other values of the object to be specified at run-time and it comes in name / value pairs as attributes. For instance <param> tag can define the width and the height of an element or "tell" the browser to automatically repeat a flash animation.

This code editor below is a combination of a form's textarea and an object.

The object element is added to the HTML to replace older and deprecated elements <applet> and <embed> so older browser might not be able to render it.

Param is an empty tag, therefore the closing tag is forbidden.

Syntax:

<object data="URI" type=""><param name="" value="" /></object>

Attributes:

Example

HTML object elements:

x
 
<html>
<head>
<title>HTML tutorial</title>
</head> 
<body>
<h5>This a flash driven animation with IE friendly code:</h5>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="350" height="220" id="FlashID" title="brand">
    <param name="movie" value="../../../img/tutorials/object_ex1.swf" />
    <param name="quality" value="high" />
    <param name="loop" value="true" />
    <param name="play" value="true" />
    <param name="scale" value="showall" />
    <param name="wmode" value="transparent" />
    <!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="../../../img/tutorials/object_ex1.swf" width="350" height="220">
    <!--<![endif]-->
        <param name="quality" value="high" />
        <param name="loop" value="true" />
        <param name="play" value="true" />
        <param name="scale" value="showall" />
        <param name="wmode" value="transparent" />
        <!--[if !IE]>-->
    </object>
    <!--<![endif]-->
</object>
</body>
</html>

 

›› go to examples ››