link to open window - How to open it centered on the screen ?

I have the code below which I use to open a window. It usually opens on the upper left corner.
How can I open it in the center of the user's screen ?

<a href="javascript:;" onClick="MM_openBrWindow('forms_bridgecallblank.asp','form','scrollbars=yes,resizable=yes,width=1000,height=800')"><i class=" btn btn-white btn-sm fa fa-eye"></i></a>

Open in new window

LVL 1
AleksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Big MontyWeb Ninja at largeCommented:
Try the following function to center your dialog:

function MyPopUpWin(url, width, height) {
    var leftPosition, topPosition;
    //Allow for borders.
    leftPosition = (window.screen.width / 2) - ((width / 2) + 10);
    //Allow for title and status bars.
    topPosition = (window.screen.height / 2) - ((height / 2) + 50);
    //Open the window.
    window.open(url, "Window2",
    "status=no,height=" + height + ",width=" + width + ",resizable=yes,left="
    + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY="
    + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
}

Open in new window


Then call the function like so:

<a href="javascript:;" onClick="MyPopUpWin('forms_bridgecallblank.asp',1000, 800)"><i class=" btn btn-white btn-sm fa fa-eye"></i></a>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AleksAuthor Commented:
Thanks. I will give it a try tonight.
AleksAuthor Commented:
There seems to be some kind of typo in the function.:

Microsoft VBScript compilation  error '800a0408' 

Invalid character 

/bluedot/Intranet/Tools/blankforms.asp, line 44 
function MyPopUpWin(url, width, height) {
----------------------------------------^

Open in new window

Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Big MontyWeb Ninja at largeCommented:
What's line 44?
AleksAuthor Commented:
<% function MyPopUpWin(url, width, height) {
AleksAuthor Commented:
nevermind .. :$ ... got it  :)
Big MontyWeb Ninja at largeCommented:
Put the function in your Javascript block, not in a server side block
AleksAuthor Commented:
Perfect !
Big MontyWeb Ninja at largeCommented:
Glad I could be of help :)
AleksAuthor Commented:
You always do.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.