JavaScript's method for dynamically resizing pop up Windows

  • 2020-05-26 07:50:19
  • OfStack

This example demonstrates how JavaScript dynamically changes the size of a pop-up window. Share with you for your reference. The details are as follows:

The JS code below demonstrates how to pop up a new window through window.open and dynamically resize the window


<!DOCTYPE html>
<html>
<head>
<script>
var w;
function openwindow()
{
w=window.open('','', 'width=100,height=100');
w.focus();
}
function myFunction()
{
w.resizeTo(500,500);
w.focus();
}
</script>
</head>
<body>
<button onclick="openwindow()">Create window</button>
<button onclick="myFunction()">Resize window</button>
</body>
</html>

I hope this article has been helpful to your javascript programming.


Related articles: