When designing a webpage, you may often encounter poor window control, especially for large screens and wide screens. Excessive stretching leads to severe page deformation. It is really not beautiful. If CSS is well written, you can avoid these problems, but sometimes it is just a simple small page, such as writing a claim or something yourself, the whole screen is too embarrassing ...... CSS makes it easy to use. The simple page still has a fixed size. Just list the two items as needed. Below we will introduce several methods for controlling the browser window size using JS:
JS controls the browser window sizeCodeOne:Program code <SCRIPT>
Window. moveTo (0, 0); // move the window
Window. resizeTo (800,600); // change the size
Window. onresize = new function ("window. resizeTo (800,600 );")
</SCRIPT>
JS controls the size of the browser window Code 2:Program code <SCRIPT>
If (window! = Top) top. Location. href = location. href;
Self. resizeTo (800,600 );
</SCRIPT>
JS controls the size of the browser window code 3:Program code <script language = "JavaScript">
Function openwin ()
{
VaR I = 0;
I = open ("", "", "width = 500, Height = 500 ");
}
</SCRIPT>
JS controls the size of the browser window code 4:Program code <script language = JavaScript>
<! --
VaR new_width = 800; // the browser width you want to fix
VaR new_height = 600; // The height of the browser you want to fix
Function resizewindow ()
{
Window. resizeTo (new_width, new_height );
}
Resizewindow ();
// -->
</SCRIPT>
......
This JS control is too much, and there will be a lot of JS introduction at any time. It is enough to leave these few. Of course, it is best to use CSS. Here we recommend that you only use it in a hurry and learn CSS thoroughly. These are all minor dishes.