- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 Width Property
The HTML DOM Object Width property is used to set or return the width of an object. This width is set in pixels. Following is the syntax to set the width of an object −
objObject.width
Following is the syntax to return the width of an object −
objObject.width = pixels
Above, pixels is the value set for the width of object.
Let us now see an example to implement the DOM object width property −
Example
<!DOCTYPE html> <html> <body> <object id="newObj" width="300" height="200" data="https://www.tutorialspoint.com/flex/samples/CSSApplication.swf" style="border:2px solid red"> </object> <p>Click to update the width.</p> <button onclick="display()">Update Width</button> <p id="myid"></p> <script> function display() { document.getElementById("newObj").width = "550"; } </script> </body> </html>
Output
Now, click the “Update Width” button to update the width −
Advertisements