Open In App

HTML | DOM Object type Property

The HTML | DOM Object type Property is used to set or return the value of a type attribute of a <object> element. The type attribute is used to specify the Internet type of MIME type of the Object. 

Syntax: 



objObject.type
objObject.type = media_type 

Property Values: It contains the value i.e media_type which specify the Internet media type of the embedded file. 

Return Value: It returns a string value which represents the Internet media type of the embedded file. 



Example: This Example returns a type Property. 




<!DOCTYPE html>
<html>
<body>
    <center>
        <object id="myobject"
                width="400"
                height="100"
                data=
                type="application/vnd.adobe.flash-movie">
          </object>
        <h2>DOM Object type Property</h2>
        <p>Click the button to get the
          height of the embedded file.</p>
        <button onclick="Geeks()">
            Click it
        </button>
 
        <p id="gfg"
           style="color:green;
                  font-size:25px;">
          </p>
    </center>
    <script>
        function Geeks() {
 
            // Return Object type Property
            var x =
                document.getElementById(
                    "myobject").type;
 
            document.getElementById(
                "gfg").innerHTML = x;
        }
    </script>
</body>
</html>

Output: 

Before Clicking On Button:

  

After Clicking On Button:

  

Supported Browsers:


Article Tags :