 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
 