How to add a parameter for an object in HTML?


To define parameters for plug-ins that is associated with object element we use <param> tag. <param> tag does not contain end tag. The <param> tag supports all browsers, but the file format defined in object may not support. It also supports the global and event attributes in HTML.

Syntax

Following is the usage of <param> tag in HTML −

<param name=” “  value=” “>

The parameter tag in HTML, accepts four attributes, as shown below −

  • name − The name attribute in param tag used to specify the name of the parameter.

  • value − The value attribute in param tag is used to specify the value of the parameter.

  • type − The type attribute in param tag is used to specify the media type.

  • valuetype − The valuetype attribute is used to specify the type of the value.

Example

Following is the example, demonstrates how to add a parameter for an object in HTML −

<!DOCTYPE html>
<html>
<body>
   <h1>Welcome To TutorialsPoint</h1>
   <h2>Demonstration of param Tag</h2>
   <object data= "https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4">
      <param name="video" value="play">
   </object>
</body>
</html>        

Example

Following example, we are trying to insert an image to the HTML page using the <object> tag and trying to add parameters to it using the <param> tag –

<!DOCTYPE html>
<html>
<head>
   <title> Defining a parameter for an object using HTML </title>
   <style>
      body {
         text-align: center;
      }
      h1 {
         color: blue;
      }
   </style>
</head>
<body>
   <h1>TutorialsPoint</h1>
   <h2>How to add a parameter for an object in HTML </h2>
   <object data="https://www.tutorialspoint.com/static/images/logo.png?v2">
      <param name="autoplay" value="true">
   </object>
</body>
</html>

Example

Following is another example −

<!DOCTYPE html>
<html>
<head>
   <title>HTML param Tag</title>
</head>
<body>
   <h1>Demonstration of param Tag</h1>
   <object title="Test Object." data="https://storage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4">
      <param name="audio" value="autoplay" />
      <param name="width" value="900" />
      <param name="height" value="200" />
   </object>
</body>
</html>

Updated on: 10-Oct-2023

716 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements