Open browser window in the center of the screen

I am using the code below to open a window and display a report, problem is that it opens on the top left of the screen and when working with many reports it gets annoying. How can I modify the code below to open it in the center of the screen ?

<img src="../../../Images/icview.gif" alt="" width="16" height="16" onClick="MM_openBrWindow('rp_contacts_03_results.asp','results','scrollbars=yes,resizable=yes,width=900,height=600')"/>
LVL 1
AleksAsked:
Who is Participating?
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
if you're willing to get a little fancy, you may want to consider using a modal pop up box. They're just as easy to use (most are one line of code after including all of the necessary files), highly customizable, and all around look more professional. I've listed some options below, any questions just ask!

http://fancybox.net/
http://dimsemenov.com/plugins/magnific-popup/
http://projects.nickstakenburg.com/lightview          (my personal favorite, easy to use and good docs)
0
 
Brian TaoSenior Business Solutions ConsultantCommented:
Change it to:
<img src="../../../Images/icview.gif" alt="" width="16" height="16" onClick="MM_openBrWindow('rp_contacts_03_results.asp','results','scrollbars=yes,resizable=yes,width=900,height=600,top='+((screen.availHeight-600)/2-20)+',left='+(screen.availWidth-900)/2)"/>

Open in new window


It adds calculated top and left to the attribute string.
0
 
AleksAuthor Commented:
Thanks to both.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.