HTML विंडो resizeBy() विधि निर्दिष्ट मानों द्वारा विंडो को उसके वर्तमान आकार के सापेक्ष आकार देती है।
सिंटैक्स
निम्नलिखित वाक्य रचना है -
window.resizeBy(w,h)
यहाँ, w और h क्रमशः विंडो की चौड़ाई और ऊँचाई को पिक्सेल में आकार देने के मान को परिभाषित करते हैं।
आइए HTML विंडो का एक उदाहरण देखें resizeBy() विधि -
उदाहरण
<!DOCTYPE html>
<html>
<style>
body {
color: #000;
height: 100vh;
background-color: #8BC6EC;
background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;
text-align: center;
}
.btn {
background: #db133a;
border: none;
height: 2rem;
border-radius: 2px;
width: 20%;
display: block;
color: #fff;
outline: none;
cursor: pointer;
margin: 1rem auto;
}
</style>
<body>
<h1>HTML Window resizeBy() Method Demo</h1>
<button onclick="create()" class="btn">Create a new window</button>
<button onclick='resize()' class="btn">Resize the window</button>
<script>
var newWindow;
function create(){
newWindow =window.open('','','width=80,height=80');
}
function resize(){
newWindow.resizeBy(100, 100);
newWindow.focus();
}
</script>
</body>
</html> आउटपुट

“नई विंडो बनाएं . पर क्लिक करें नई विंडो बनाने के लिए बटन:

अब “विंडो का आकार बदलें . पर क्लिक करें नई बनाई गई विंडो का आकार बदलने के लिए बटन -
