3 Replies - 11736 Views - Last Post: 21 May 2008 - 03:22 AM

#1 vivanvivan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-May 08

How to position a pop up window?

Post icon  Posted 10 May 2008 - 02:27 PM

Hello,

I've this script for a pop up window:

 {literal}
<script language="Javascript"><!--
function createNewReviewWindow (where)
{
	window.open(where, 'newproductreview', 'width=475,height=500,scrollbars=1');
}
--></script>
{/literal}


This pop up window appears at the left top of the screen.
How could I put this pop up window in the middle of the screen?

Thanks in advance

Is This A Good Question/Topic? 0
  • +

Replies To: How to position a pop up window?

#2 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Re: How to position a pop up window?

Posted 21 May 2008 - 01:39 AM

Hello,
calculate the screen center position by using the screen height and width properties
try the top and left property
l=(screen.width-475)/2;
t=(screen.height-500)/2;
    window.open(where, 'newproductreview', 'width=475,height=500,scrollbars=1,left'+l+',top='+t);



Hope it helps

This post has been edited by ahmad_511: 21 May 2008 - 01:46 AM

Was This Post Helpful? 0
  • +
  • -

#3 vivanvivan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 10-May 08

Re: How to position a pop up window?

Posted 21 May 2008 - 02:42 AM

Hi ahmad_511,

Thanks, it works fine!
Was This Post Helpful? 0
  • +
  • -

#4 ahmad_511  Icon User is offline

  • MSX
  • member icon

Reputation: 131
  • View blog
  • Posts: 722
  • Joined: 28-April 07

Re: How to position a pop up window?

Posted 21 May 2008 - 03:22 AM

you're welcome

Bests
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1