[Javascript] Re: DHTML Menu

Rodney Myers rodney at aflyingstart.net
Thu Apr 18 08:54:22 CDT 2002


You don't say where the window does position itself, but my guessis that at best it would be too far right and too far down and that the top left corner would be central in the window?

 From a maths perspective
top=(screen.height-h)/2
would make the top of the window half way down, which is different from centring the popup because it takes no account of the height of the popup, so you you would want to adjust by half of that.

 From a hjavascripting perspective I am by no means certain that math expressions can be used in this context. I would tend to want to compute these in advance and build up the string of window attributes to include the
answer rather than expect the window.open method to be able to compute math expressions

hth

Rodney


phumes1 wrote:

> I'm using the DHTML menu
> (http://www.webreference.com/dhtml/hiermenus/latest/)on my page and would
> like the popup window to automatically center on the screen.
>
> How can I incorporate the "top" and "left" within the code in my
> "hm_arrays" file?
>
> The below code doesn't center the popup window yet I get no JS errors?
>
> ["E<nable","javascript:window.open('admin/accounts/enable.cfm','','toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,top=(screen.height-h)/2,left=(screen.width-w)/2,width=280,height=130')",1,0,0],
>
> +-----------------------------------------------------------------------------------+
>
> Philip Humeniuk
> phumes1 at rogers.com
> phil.humeniuk at rogers.com
> +------------------------------------------------------------------------------------+




More information about the Javascript mailing list