Open In App

HTML | DOM Parameter Object

The Parameter Object in HTML DOM is used to create and access the <param> element with in the object.Parameters for plugin embedded with an element is done by using the element. 
Syntax: 
 

var x = document.getElementById("myParam");
var x = document.createElement("PARAM");

Property Values: 
 



Example-1: Access param element’s name value. 
 




<!DOCTYPE html>
<html>
    <title
        HTML DOM Parameter Object
    </title>
<body>
    <h4>Click the button</h4>
    <button onclick="GFG()">Click Here!<br>
    </button>
      
<p></p>
  
        <object data="sample.mp4"
            <param id="myParam" name="Autoplay" value="true"
        </object>
    <p id="Geeks"></p>
  
    <script>
        function GFG() {
                   var x = document.getElementById("myParam").name;
           document.getElementById("Geeks").innerHTML = x;
        }
    </script>
</body>
</html>

Output: 
 



Example-2: Create param element using document.createElement(“OBJECT”);. 
 




<!DOCTYPE html>
<html>
    <title
        HTML DOM Parameter Object 
    </title>
<body>
    <h4>Click the button</h4>
    <button onclick="GFG()">Click Here!<br>
    </button>
      
<p></p>
  
    <script>
        function GFG() {
            var x = document.createElement("OBJECT");
            x.setAttribute("data", "sample.mp4");
            x.setAttribute("id", "myObject");
            document.body.appendChild(x);
  
            var y = document.createElement("PARAM");
            y.setAttribute("name", "autoplay");
            y.setAttribute("value", "true");
            document.getElementById("myObject").appendChild(y);    
        }
    </script>
</body>
</html>

Output: 
 

Steps to execute the above code: 
 

Supported Browsers: The browser supported by DOM Parameter Object property are listed below: 
 

 


Article Tags :