window.resizeTo()
We can resize window to a fixed width and height by using window resizing function , here is the code.
Window.resizeTo(X,Y);
We will try to develop an example in which by click of a button we will resize window to 300 width and 300 height
demo of resizeTo()
Here is the code.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Demo of resizeTo to fix width and height of a window</title>
<script language=javascript>
function to_close(){
tm.close();q
}
function to_open(){
tm=window.open("moveby-child.htm","Ratting","width=250,height=150,0,top=200,status=0,");
}
function to_resizeTo(){
tm.resizeTo(300,300);
tm.focus(); // Keeping the focus on small window
}
</script>
</head>
<body>
<input type="button" name="btn" value="Open" onclick="to_open()";>
<input type="button" name="btn" value="Close" onclick="to_close()";>
<input type="button" name="btn" value="Resize To" onclick="to_resizeTo()";>
<br><br>
Return to <a href=resizeto.php>resizeTo</a> | <a href=window-object.php>window object</a>
</body>
</html>
The code for child window is available at moveBy
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
plus2net.com
|