Window.Open Open Page Center display sample Code _javascript tips

Source: Internet
Author: User

1.js

Copy Code code as follows:

<script type= "Text/javascript" >

function Openwindow (url,name,iwidth,iheight)
{
URL to the address of the Web page
Name of the page, nullable
Iwidth the width of the pop-up window
Iheight the height of the pop-up window
Window.screen.height Gets the high screen, Window.screen.width gets the width of the screen
var itop = (window.screen.height-30-iheight)/2; Gets the vertical position of the window;
var ileft = (window.screen.width-10-iwidth)/2; Get 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. Calling methods
Copy Code code as follows:

<a href= "javascript:void (0);" onclick= "Javascript:openwindow (' a.html ', ', ', 400,200);" > Go to a</a>

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.