Attributes of the object and param

HTML <object> - embedding media

The <object> tag is used for embedding media contents (such as images, Java applets, Flash, movie, audio, or even another HTML file) on a web page.
The object element is partially supported in all major browsers, depend on the object inserted into HTML document.
If the object element is not displayed, the code between the <object> and </object> tags will be executed, so you can add an alternative text or an image.

This element is designed to include any sort of document. It uses the type attribute to indicate the "mime type", and the data attribute to indicate the source of the document (its URI).
If the browser (or one of its plugin) can interpret the embedded object, will download and play /run it, otherwise the nested content of the object is displayed.
Any HTML code can be inserted as an alternative content, for example a link to the document or an image.


Embed a PDF document

<object type="application/pdf" data="dir/html_course.pdf" width="300" height="200">
 <img src="dir/html_course.jpg" alt="HTML course" />
- Here the browser will show a PDF document if it supports the PDF format, otherwise it will show a JPG image (html_course.jpg).
The "width" and "height" attributes define the visible area of the object. The browser scale the object to these dimensions.

Embed an HTML file

<object type="text/html" data="dir/test.html" width="500" height="350">
  alt: <a href="dir/test.html" title="Test">test.html</a>
- If the browser can't use the object element to include an "text/html" file, will show the link added between the <object> and </object> tags (alt: test.html).

• The object element may also contain a number of param elements to define parameters or values for the object when it displays or plays.

Embed a SWF file

- This example includes a Flash game (in SWF format), and uses a <param> tag to define a background color for the area in which the game is displayed (set with the "width" and "height" attributes).
- Internet Explorer sometimes needs a <param> with a src parameter to understand the location.
<object type="application/x-shockwave-flash" data="games/cubilus.swf" width="500" height="250">
 <param name="src" value="html/l/cubilus.swf" />
 <param name="bgcolor" value="#fbfbfe" />
 Your browser not support SWF.
If the browser supports SWF application, will display the "cubilus" game, otherwise shows the text: "Your browser not support SWF."
Here is the result:
Your browser not support SWF.

Embend a WAV file

<object type="audio/x-wav" data="dir/test.wav" width="200" height="20">
  <param name="src" value="dir/test.wav" />
  <param name="autoplay" value="false" />
  <param name="autoStart" value="false" />
  Alt : <a href="dir/test.wav" title="WAV file">test.wav</a>
- Depending on the object, the major browsers use different codes to load the same object type. QuickTime understand the "autoplay" parameter. Windows media Player and Real Audio understand "autoStart" parameter.

Embendding audio MP3

<object type="audio/mpeg" data="audio/test.mp3" width="200" height="20">
 <param name="src" value="audio/test.mp3">
 <param name="autoplay" value="false" />
 <param name="autoStart" value="false" />
  Your system can't play audio/mpeg files.

Embendding MOV files

- For some types, like QuickTime document (MOV files), IE needs a non-standard value to the classid attribute, an identifier to load an associated activeX.
We can nest another object as an alternative content, for the other browsers that use the standard code:
<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="" width="480" height="360">
  <param name="src" value="dir/">
  <param name="controller" value="true" />
  <param name="autoplay" value="false" />

  <object type="video/quicktime" data="dir/" width="480" height="360">
   <param name="controller" value="true" />
   <param name="autoplay" value="false" />
   You do not have QuickTime Player installed.

Attributes of the HTML object tag

The <object> tag supports the following attributes (along with: "id", "class", "style", "title"):

Attributes of the param tag

The <param> tag supports the following attributes:

Daily Test with Code Example

Which tag is used to add lists into <ul> and <ol> elements?
<dt> <dd> <li>
Which value of the "display" property creates a block box for the content and ads a bullet marker?
block list-item inline-block
.some_class {
  display: list-item;
Which instruction converts a JavaScript object into a JSON string.
JSON.parse() JSON.stringify eval()
var obj = {
 "courses": ["php", "javascript", "ajax"]
var jsonstr = JSON.stringify(obj);
alert(jsonstr);    // {"courses":["php","javascript","ajax"]}
Indicate the PHP class used to work with HTML and XML content in PHP.
stdClass PDO DOMDocument
$strhtml = '<body><div id="dv1"></div></body>';
$dochtml = new DOMDocument();
$elm = $dochtml->getElementById("dv1");
echo $elm->nodeValue;    //
HTML object and param

Last accessed pages

  1. Escape From Lonely Room (74)
  2. Image Map (1621)
  3. Magic Methods __get, __set, __call, __toString (2137)
  4. PHP Script Website Mini-Traffic (2833)
  5. Shape Fold (34)

Top accessed pages

  1. Courses Web: PHP-MySQL JavaScript Ajax HTML CSS Flash-AS3 (45791)
  2. Read Excel file data in PHP - PhpExcelReader (34450)
  3. PHP-MySQL free course, online tutorials PHP MySQL code (34339)
  4. Get Attribute (ID, Class, Name, Title, Src) with jQuery (30919)
  5. PHP PDO - exec (INSERT, UPDATE, DELETE) MySQL (28165)