Forum Moderators: open

Message Too Old, No Replies

Positioning a window

         

chrman

3:22 am on Sep 19, 2001 (gmt 0)



I am using the following bit of code to open a window from an index page.

<a href="#DSS" onclick="window.open('indextest.htm','DSS','height=900,width=1100,resizable=yes,scrollbars=yes')" style="text-decoration: none">

is there a variable i can add to give it an absolute position of say 20 pixels down, 20 pixels across. When i open it as is it open with the whole bottom half of the page missing which makes you have to move it as soon as it opens to access it.

Marshall

4:25 am on Sep 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



chrman,

Add this to the script:

left=20,top=20

Or use what ever variable you need. :)

chrman

1:23 pm on Sep 19, 2001 (gmt 0)



Thanks, that worked perfect. When you said add any variable you need, did you mean that there is a way to make up your own variables in a javascript command? I'm still a js newbie here. If so, any hints on where to go read up on how it's done?

Marshall

3:17 pm on Sep 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



chrman,

I was merely referring to the distance: 20, 50 1000 if you wish, though 1000 would be really far away :) There are a couple of sites that have free javascripts for a variety of tasks: www.24fun.com and [javascript.internet.com...] are two that come to mind.

tedster

7:01 pm on Sep 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's an added bit of information: Netscape 4.x requires different variables for positioning a new window (screenX and screenY). So for true cross-browser compatibility, you need to add four attributes to the script:
left=20,top=20,screenX=20,screenY=20

Here's a handy reference for all the possible features for window.open()
[webreference.com...]

Marshall

8:20 pm on Sep 19, 2001 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



tedster,

I thought I knew nearly all the NN4 quirks. Missed that one. Thanks.