JS open new page in the middle of the screen implementation method _javascript tips

Source: Internet
Author: User
 <a href=" javascript:void (0) "onclick=" window.open (' http://www.jb51.net ', ' NewWindow ', ' height=500, width=900, top= ' +math.round (window.screen.height)/2<span style= "Font-family:arial, Helvetica, Sans-serif; " >-250</span><span style= "font-family:arial, Helvetica, Sans-serif;" >) + ', left= ' +math.round (window.screen.width)/2</span><span style= "Font-family:arial, Helvetica, Sans-serif; " >-450</span><span style= "font-family:arial, Helvetica, Sans-serif;" >) + ', Toolbar=no, Menubar=no, Scrollbars=no, Resizable=no,location=no, Status=no ') > agreed to Exchange </a></span > 
 </pre><pre code_snippet_id=" 1613432 "Snippet_file_name=" blog_2016 0317_3_5070514 "name=" code "class=" HTML "> 
<pre name= "code" class= "HTML" ><script> 
function Openwin () { 
var width=math.round ( Window.screen.width)/2<span style= "font-family:arial, Helvetica, Sans-serif;" >-400</span>); 
var height=math.round ((window.screen.height)/2<span style= "font-family:arial, Helvetica, Sans-serif;" >-200</span><span style= "font-family:arial, Helvetica, Sans-serif;" >);</span> 
window.open (' http://www.jb51.net ', ' newwindow ', ' height=200 ', width=400, top= ' +height+ ', Left= ' +width+ ', Toolbar=no, Menubar=no, Scrollbars=no, Resizable=no,location=no, Status=no ') 
} 
</script > 
 
 

Where yes/no can also use 1/0;pixel value as the specific value, the unit pixel.

Parameters Take value range Description
Alwayslowered Yes/no Specifies that the window is hidden behind all windows
Alwaysraised Yes/no Specifies that the window is suspended above all windows
Depended Yes/no Whether to close the parent window at the same time
Directories Yes/no Whether the NAV2 and 3 columns are visible
Height Pixel value Window height
Hotkeys Yes/no Set up a secure exit hotkey in a window without a menu bar
Innerheight Pixel value Pixel height of the document in the window
Innerwidth Pixel value Pixel width of the document in the window
Location Yes/no Whether the position bar is visible
MenuBar Yes/no Whether the menu bar is visible
Outerheight Pixel value Set the pixel height of a window (including a decorative border)
Outerwidth Pixel value Set the pixel width of a window (including a decorative border)
Resizable Yes/no Whether the window size can be adjusted
ScreenX Pixel value The pixel length of the window from the left edge of the screen
ScreenY Pixel value The pixel length of the window from the edge of the screen
ScrollBars Yes/no Whether a window can have a scroll bar
TitleBar Yes/no Whether the window topic bar is visible
Toolbar Yes/no Whether the window toolbar is visible
Width Pixel value The pixel width of the window
Z-look Yes/no Whether the window floats on top of other windows when it is activated

The above is small series for everyone to bring JS open a new page in the middle of the screen in the implementation of the whole content, I hope that we support cloud Habitat Community ~

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.