Open In App

HTML | DOM Object data Property

Last Updated : 25 Aug, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

The HTML | DOM Object data Property is used to set or return the value of the data attribute of an <object> element. The data attribute is used to specify the URL of the resource which will be used by the object.
Syntax: 

  • Return the data property. 
objObject.data
  • It is used to set the data property. 
objObject.data = URL

Property Values: It contains the value i.e URL which specifies the URL of the resource. 

  • Absolute URL: It is used to point another website.
  • Relative URL: It points to link within a website.

Return Value: It returns a String that represents the object URL. Returns the full URL, including the protocol (like http://)

Example: This Example returns a data Property. 

HTML




<!DOCTYPE html>
<html>
<body>
    <center>
        <object id="myobject"
                data="HelloGeeks.swf"
                width="400"
                height="100"
                name="myGeeks"
                form="myGeeks"
                data=
          </object>
        <h2>DOM Object data Property</h2>
        <button onclick="Geeks()">
            Click it
        </button>
        <p id="gfg"
           style="color:green;
                  font-size:25px;">
          </p>
 
    </center>
    <script>
        function Geeks() {
 
            // return object data type Property
            var x =
                document.getElementById(
                    "myobject").data;
 
            document.getElementById(
                "gfg").innerHTML = x;
        }
    </script>
</body>
</html>


Output: 
Before Clicking On Button: 

After Clicking On Button: 

Supported Browsers: 

  • Google Chrome 
  • Mozilla Firefox 
  • Edge 
  • Safari 
  • Opera 


Similar Reads

HTML | DOM Object Object
The Object object represents only HTML &lt;object&gt; element. We can access any &lt;object&gt; element by using the getElementById(); and also can create object element by using createElement(); method.Syntax: It is used to access Object element document.getElementById("id"); It is used to create object element document.createElement("object"); Pr
2 min read
HTML DOM Object useMap Property
The HTML DOM Object useMap Property is used to set or return the value of the usemap attribute of an &lt;object&gt; element. The &lt;object&gt; usemap attribute is used to specify the name of an image-map to use with the object. The image with clickable areas is called an image map. The useMap attribute is related to the association with the &lt;ma
2 min read
HTML | DOM Object name Property
The HTML | DOM Object name Property is used to set or return the value of a name attribute of an &lt;object&gt; element. The name attribute is used to specify the name of the embedded file. Syntax: It returns the name property objObject.nameIt is used to set the name property. objObject.name = name Property Values: It contains the value i.e name wh
2 min read
HTML | DOM Object Height Property
The HTML | DOM Object height Property in HTML DOM is used to set or return the height of the Object. The height attribute is used to specify the height of the Object. Syntax: It returns the height propertyobjObject.heightIt is used to set the height property.objObject.height = pixels Property Values: It contains the value i.e pixel Which is used to
2 min read
HTML | DOM Object form Property
The DOM Object form Property in HTML DOM is used to set or return the value of the form attribute of an &lt;object&gt; element. The form attribute is used to specify the one or more forms the &lt;object&gt; will contain. Syntax: It returns the form property.objObject.formIt is used to set the form property:objObject.form = form_id Property Values:
1 min read
HTML | DOM Object width Property
The DOM Object width Property in HTML DOM is used to set or return the width of the Object. The width attribute is used to specify the width of an Object. Syntax: It returns the width property. objObject.widthIt is used to set the width property. objObject.width = pixels Property Values: It contains the value i.e pixel which specifies the width of
2 min read
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 &lt;object&gt; element. The type attribute is used to specify the Internet type of MIME type of the Object. Syntax: It returns the type property.objObject.typeIt is used to set the type property.objObject.type = media_type Property Values: It contains th
1 min read
HTML | DOM Object align Property
The HTML DOM Object align property is used to set or return the value of the data attribute of an element. Note: This property is not supported by HTML5 Syntax: It returns the object align property.objectobject.align;It sets the object to align property.objectobject.align="left | right | middle | top | bottom" Property Values: left: It sets the obj
2 min read
HTML DOM Object vspace Property
The HTML DOM Object vspace property is used to set or return the value of the vspace attribute of the object element. The vspace attribute is used to specify the number of whitespaces from the top and bottom sides of an object. Syntax It returns the object vspace property. objObject.vspace; It sets the object vspace property. objObject.vspace="pixe
2 min read
HTML DOM Object hspace Property
The HTML DOM Object hspace property is used to set or return the value of the hspace attribute of the &lt;object&gt; element. The hspace attribute is used to specify the number of whitespaces for the left and right side of an Object. Syntax It returns the hspace Property. objObject.hspace; It sets the hspace Property. objObject.hspace="pixels"; Pro
2 min read
Article Tags :