Window. open the sample code displayed in the center of the page

Source: Internet
Author: User

1. js
Copy codeThe Code is as follows:
<Script type = "text/javascript">

Function openwindow (url, name, iWidth, iHeight)
{
// The url to the webpage address
// Name the webpage name, which can be blank
// The width of the iWidth pop-up window
// The height of the iHeight pop-up window
// Window. screen. height obtains the screen height, and window. screen. width obtains the screen width.
Var iTop = (window. screen. height-30-iHeight)/2; // obtain the vertical position of the window;
Var iLeft = (window. screen. width-10-iWidth)/2; // obtain the horizontal position of the window;
Window. open (url, name, 'height = '+ iHeight +', innerHeight = '+ iHeight +', width = '+ iWidth +', innerWidth = '+ iWidth + ', top = '+ iTop +', left = '+ iLeft +', toolbar = no, menubar = no, scrollbars = auto, resizeable = no, location = no, status = no ');
}

</Script>

2. Call Method
Copy codeThe Code is as follows:
<A href = "javascript: void (0);" onclick = "javascript: openwindow('a.html ','', 400,200); "> go to a </a>

Related Article

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.