HTML DOM Parameter Object

HTMLWeb DevelopmentFront End Technology

The HTML DOM Parameter Object represent the <param> element of an HTML document.

Create param object

Syntax

Following is the syntax −

document.createElement(“PARAM”);

Properties of param object

Property
Explanation
name
It returns and modify the value of the name attribute of a param element in an HTML document.
value
It returns and modify the content of the value attribute of a param element in an HTML document.

Example

Let us see an example of param object −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<style>
   html{
      height:100%;
   }
   body{
      text-align:center;
      color:#fff;
      background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) center/cover no-repeat;
      height:100%;
   }
   .btn{
      background:#0197F6;
      border:none;
      height:2rem;
      border-radius:2px;
      width:60%;
      margin:2rem auto;
      display:block;
      color:#fff;
      outline:none;
      cursor:pointer;
   }
</style>
</head>
<body>
<h1>DOM Parameter Object Demo</h1>
<button onclick="create()" class="btn">Create a Param element</button>
<script>
   function create() {
      var objectElement = document.createElement("OBJECT");
      objectElement.setAttribute("data", "https://www.tutorialspoint.com/html/Kalimba.mp3");
      objectElement.setAttribute("class", "object-element");
      document.body.appendChild(objectElement);
      var paramObject = document.createElement("PARAM");
      paramObject.setAttribute("name", "autoplay");
      paramObject.setAttribute("value", "true");
      document.querySelector(".object-element").appendChild(paramObject);
   }
</script>
</body>
</html>

Output

This will produce the following output −

Click on “Create a Param element” button to create a <param> element in the HTML document −


raja
Published on 19-Jul-2019 16:41:08
Advertisements