JavaScript special effect instance 005-control the center display in the pop-up window, javascript005-
In the instance 005 control pop-up window, center displays the instance description, click the button on the page, and the window is centered. Technical points this example first applies the open () method of the window object in JavaScript to open a new window of the specified size, and then obtains the screen resolution through the screen object, then, based on the obtained value, move the new window to the center position of the screen using the moveTo () method of the window object. The moveTo () method moves the window to the specified coordinate (x, y). The syntax format is as follows.
window.moveTo(x,y)
The x and y parameters indicate the coordinates at which the window is moved. The screen object is a screen object in JavaScript, reflecting the screen settings of the current user.
Common Properties of screen objects
Attribute |
Description |
Width |
Horizontal size of the user's entire screen, in pixels |
Height |
The vertical size of the entire screen, in pixels. |
PixelDepth |
The number of digits in each pixel of the monitor. |
ColorDepth |
Returns the number of digits used in the current color settings. 1 indicates black and white, 8 indicates 256 colors, 16 indicates enhancement colors, and 24/32 indicates true colors. Color. The 8-bit color supports 256 colors, and the 16-bit color (usually called "enhanced color") supports about 64000 colors. The 24-digit color (usually called "true color") supports about 16 million colors. |
AvailHeight |
Returns the vertical size of the window content area, in pixels. |
AvailWidth |
Returns the horizontal size of the window content area, in pixels. |
Current process 1. window to be popped up new.html
<Html> 2.The page index.html of the current function
<Span style = "font-size: 14px;"> Note: The content of the style label is css. We focus on the content in the script label. In this way, our instance is ready.