How to center pop up window on cereen?

Good day to every one
im trying to centre the pop up window and not sure how to make it.
below is the script

<script language="javascript">
function target_popup(form) {
    window.open('', 'formpopup', 'width=900,height=400, resizeable,scrollbars,');
    form.target = 'formpopup';
}
</script>
 <form id="theform" name="order" method="post" action="confirm.php" onsubmit="target_popup(this)" enctype="multipart/form-data" style="position:absolute; left:0px; top:0px">

Thank you :slight_smile:

is my question celar? or difficult :frowning:

Please if any one can help.
Thank you

The following seems to work:


popupCenter('', 'formPopup', 900, 400, {
    resizable: 'yes',
    scrollbar: 'yes'
});

The popupCenter function just uses half of the existing width and height of the window:


function popupCenter(pageURL, title, width, height, options) {
    options = options || {};
    options.left = (screen.width / 2) - (width / 2);
    options.top = (screen.height / 2) - (height / 2);

    return popup(pageURL, title, width, height, options);
}

And the popup function can be as complex or as simple as you like, but something like this should mean that it can be used for multiple types of situations:


function popup(pageURL, title, width, height, options) {
    return window.open(pageURL, title,
        'width=' + (width || options.width || '') + ',' +
        'height=' + (height || options.height || '') + ',' +
        'left=' + (options.left || '') + ',' +
        'top=' + (options.top || '') + ',' +
        'toolbar=' + (options.toolbar || 'no') + ',' +
        'location=' + (options.location || 'no') + ',' +
        'directories=' + (options.directories || 'no') + ',' +
        'status=' + (options.status || 'no') + ',' +
        'menubar=' + (options.menubar || 'no') + ',' +
        'scrollbars=' + (options.scrollbars || 'no') + ',' +
        'resizable=' + (options.resizable || 'no') + ',' +
        'copyhistory=' + (options.copyhistory || 'no') + ','
    );
}

Thank you paul :slight_smile: