
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM Object data Property
The HTML DOM Object data property returns a string corresponding to the value of the attribute data.
Following is the syntax −
Returning string value
ObjectElement.data
Set data property to a string value
ObjectElement.data = URLString
Let us see an example of HTML DOM Object data property −
Example
<!DOCTYPE html> <html> <head> <title>HTML DOM Object data</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } </style></head> <body> <form> <fieldset> <legend>HTML-DOM-Object-data</legend> <object id="objSelect" height="200" data="https://www.tutorialspoint.com/python_blockchain/images/python-blockchain-mini-logo.jpg"> </object> <input type="button" onclick="getObjectData()" value="Get URL"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var objSelect = document.getElementById("objSelect"); function getObjectData() { objSelect.data divDisplay.textContent = 'URL of above picture: '+objSelect.data; } </script> </body> </html>
Output
Before clicking ‘Get URL’ button −
After clicking ‘Get URL’ button −
- Related Articles
- HTML DOM Object Height Property
- HTML DOM Object Width Property
- HTML DOM Object name Property
- HTML DOM Object type Property
- HTML DOM Object form Property
- HTML DOM InputEvent data Property
- HTML DOM Input Submit object property
- HTML DOM HTML Object
- HTML DOM Object Object
- HTML DOM tagName Property
- HTML DOM accessKey Property
- HTML DOM activeElement Property
- HTML DOM name Property
- HTML DOM nextElementSibling Property
- HTML DOM nextSibling Property

Advertisements