BOM Browser Object Model Window resizeBy and resizeTo Methods tutorial in JavaScript

 <!DOCTYPE html>

<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>BOM resizeBy resizeTo Method JavaScript</title>
</head>

<body>
    <!--JS resizeBy()
The resizeBy() method resizes a window by a specified amount.
Syntax :
resizeBy(width, height)
Window resizeTo()
The resizeTo() method resizes a window to a new width and height.
Syntax :
window.resizeTo(width, height)-->
    <button onclick="openWindow()">Open Window</button>
    <button onclick="resizeToWindow()">ResizeTo Window</button>
    <button onclick="resizeByWindow()">ResizeBy Window</button>
    <script>
        var myWindow;
        function openWindow() {
            myWindow = window.open("", "_blank", "width=200px,height=200px,left=30px,top=30px");
            myWindow.document.write("<p>This is myWindow.</p>");
        }
        function resizeToWindow() {
            myWindow.resizeTo(500, 500);
        }
        function resizeByWindow() {
            myWindow.resizeBy(500, 500);
        }
    </script>
</body>

</html>



Comments

Popular posts from this blog

Symbols tutorial in Advance JavaScript

Async and Await Method tutorial in Advance JavaScript

String Methods in JavaScript