Javascript examples for DOM HTML Element:IFrame
The width property sets or gets the width attribute in an iframe element.
Set the width property with the following Values
Value | Description |
---|---|
pixels | The width in pixels ("100px" or just "100") |
A String, representing the width of the iframe, in pixels
The following code shows how to change the width of an iframe:
<!DOCTYPE html> <html> <body> <iframe id="myFrame" src="http://java2s.com" height="200" width="250"></iframe> <button onclick="myFunction()">Test</button> <script> function myFunction() {//w w w . ja v a 2 s. co m document.getElementById("myFrame").width = "400"; } </script> </body> </html>