Home >Web Front-end >JS Tutorial >JS method to dynamically modify iframe height and width_javascript skills
The example in this article describes the method of dynamically modifying the height and width of iframe with JS. Share it with everyone for your reference. The details are as follows:
If you want to dynamically modify the height and width of the iframe through buttons, you can refer to the following JS code
<!DOCTYPE html> <html> <head> <script> function changeSize() { document.getElementById("myframe").height="300"; document.getElementById("myframe").width="300"; } </script> </head> <body> <iframe id="myframe" src="/default.asp" height="200" width="200"> <p>Your browser does not support iframes.</p> </iframe> <br><br> <input type="button" onclick="changeSize()" value="Change size"> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.