JavaScript effect Instance 005-control pop-up window center display

Source: Internet
Author: User
Tags script tag

Example 005 control pop-up window Center Display Instance DescriptionClick the button on the page to pop up the window and center the window. Technical EssentialsThis example first applies the open () method of the Window object in JavaScript, opens a new window of the specified size, and then passes through the screen object, obtains the display resolution, and then passes the MoveTo () method of the Window object based on the obtained value. Moves the new window to the center of the screen. The MoveTo () method moves the window to the specified coordinates (x, y) in the following syntax format.
Window.moveto (x, y)

where parameter x, y represents the coordinate value at the position where the window is moved. the Screen object is an onscreen object in JavaScript that reflects the current user's screen settings.
Common properties of the screen object
Properties Description
Width The horizontal size of the user's entire screen, in pixels
Height The vertical size of the user's entire screen, in pixels
Pixeldepth Number of bits per pixel of the display
ColorDepth Returns the number of digits used for the current color setting, 1 for black and white, 8 for 256 colors, 16 for enhanced color, and 24/32 for True Color
Color. The 8-bit color supports 256 colors, and 16-bit colors (often called "enhanced colors") support about 64000 colors, while
24-bit colors (often called "true Colors") support about 16 million colors.
Availheight Returns the vertical size of the window's content area, in pixels
Availwidth Returns the horizontal dimension of the window's content area, in pixels
Implementation process1. The window to pop upnew.html
2. The page that implements the functionindex.html
<span Style= "FONT-SIZE:14PX;" >
Note: The content of the style tag is the knowledge of CSS, and we focus on the content within the script tag. So this example of ours is done.



JavaScript effect Instance 005-control pop-up window center display

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.