
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
HTML DOM Object Name Property
The HTML DOM Object name property sets or returns the value of the name attribute. However, the name attribute only sets the name.
Following is the syntax to set the object name property −
obj.name
Following is the syntax to return the object name property −
obj.name = name
Let us now see an example to implement the DOM Object name property −
Example
<!DOCTYPE html> <html> <body> <object id="obj1" width="570" height="350" data="https://www.tutorialspoint.com/flex/samples/CSSApplication.swf" name="obj"></object> <button onclick="display()">Change the object name</button> <p id="demo"></p> <script> function display() { document.getElementById("obj1").name = "obj2"; document.getElementById("demo").innerHTML = "Name updated to obj2"; } </script> </body> </html>
Output
Now, click the button to update the object name −
Advertisements