HTML DOM Embed width Property
JavaScript Reference
JavaScript Objects
- JavaScript Array Object
- JavaScript Boolean Object
- JavaScript Date Object
- JavaScript Math Object
- JavaScript Number Object
- JavaScript String Object
- JavaScript RegExp Object
- JavaScript Global Properties/Functions
- JavaScript Operators
- JavaScript Error
Browser Objects
DOM Objects
- HTML DOM Document Object
- HTML DOM Element Object
- HTML DOM Attribute Object
- HTML DOM Event Object
- HTML DOM Console Object
- CSSStyleDeclaration Object
- DOM HTMLCollection
HTML Objects
- <a>
- <area>
- <audio>
- <base>
- <blockquote>
- <body>
- <button>
- <canvas>
- <col>
- <colgroup>
- <datalist>
- <del>
- <details>
- <dialog>
- <embed>
- <fieldset>
- <form>
- <iframe>
- <frameset >
- <img>
- <ins>
- <input> - button
- <input> - checkbox
- <input> - color
- <input> - date
- <input> - datetime
- <input> - datetime-local
- <input> - email
- <input> - file
- <input> - hidden
- <input> - image
- <input> - month
- <input> - number
- <input> - range
- <input> - password
- <input> - radio
- <input> - reset
- <input> - search
- <input> - submit
- <input> - text
- <input> - time
- <input> - url
- <input> - week
- <keygen>
- <link>
- <label>
- <legend>
- <li>
- <map>
- <menu>
- <menuItem>
- <meta>
- <meter>
- <object>
- <ol>
- <optgroup>
- <option>
- <param>
- <progress>
- <q>
- <script>
- <select>
- <source>
- <style>
- <table>
- <td>
- <th>
- <tr>
- <textarea>
- <title>
- <time>
- <track>
- <video>
Embed width Property
Example
Change the width of the embedded file to 500 pixels:
document.getElementById("myEmbed").width="500";
Definition and Usage
The width property sets or returns the width of the <embed> element.
The width property describes the width of the embedded file, in pixels.
Tip: Use the height property to set or return the height of the <embed> element.
Browser Support
All major browsers support the width property.
Syntax
Return the width property:
embedObject.width
Set the width property:
embedObject.width=pixels
Property Values
| Value | Description |
|---|---|
| pixels | Specifies the width of the embedded file, in pixels. (e.g., width="100") |
Technical Details
| Return Value: | A Number, representing the width of the embedded content, in pixels |
|---|
More Examples
Example
Get the width of the embedded file:
var x = document.getElementById("myEmbed").width;
The value of x will be:
200
Example
Change the height and width of the embedded file to 500 pixels:
document.getElementById("myEmbed").height="500";
document.getElementById("myEmbed").width="500";
Related Pages
HTML Reference: HTML <embed> width Attribute
YouTip