screenX and screenY not working properly

Discussion in 'Javascript' started by Matt Stanley, Jan 6, 2004.

  1. Matt Stanley

    Matt Stanley Guest

    I'm trying to use a popup window script that opens the new window to a
    specific X,Y coordinate... I'm pretty sure that the window.screenX and
    window.screenY properties are the answer, but I'm having very little success
    in making this all work in both IE and NS.

    Here's my code as it stands today:

    function windowOpen3(URL, windowW, windowH) {
    strWindow =
    'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,re
    sizable=0,size=yes,width=' + windowW + ',height=' + windowH +
    'screenX=100,screenY=100'
    window.open(URL,'hwWindow',strWindow)
    }

    IE is ignoring the X,Y coordinates completely and opening the new window so
    far over to the right that half of it is off-screen and NS is picking up the
    screenY setting but ignoring screenX.

    Am I missing something here? Please help, and TIA.

    Stanman
     
    Matt Stanley, Jan 6, 2004
    #1
    1. Advertising

  2. "Matt Stanley" <> writes:

    > 'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,re
    > sizable=0,size=yes,width=' + windowW + ',height=' + windowH +
    > 'screenX=100,screenY=100'

    ....
    > IE is ignoring the X,Y coordinates completely


    Yep. They never claimed to understand it.
    <URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp>

    > NS is picking up the screenY setting but ignoring screenX.


    Missing "," before "screenX".

    > Am I missing something here? Please help, and TIA.


    I recommend using "left" and "top" instead of "screenX" and "screenY".
    These properties seem to work in all browsers since Netscape 4 (do tell
    me if you find exceptions :)
    <URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_2>

    While it is not documented by Netscape, "left" and "top" it seems to
    be supported from (at least) Netscape 4.08.
    (<URL:http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/window.html#1202731>)
    I doesn't work in Netscape 3, but that's not really a problem any more.

    Actually, I recommend aginst trying to position windows at all. In MDI
    browsers or dual-monitor displays, it can be quite disruptive, and in other
    browsers, it's usually not needed.
    <URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_3>

    /L
    --
    Lasse Reichstein Nielsen -
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    'Faith without judgement merely degrades the spirit divine.'
     
    Lasse Reichstein Nielsen, Jan 6, 2004
    #2
    1. Advertising

  3. Matt Stanley

    Lee Guest

    Matt Stanley said:
    >
    >I'm trying to use a popup window script that opens the new window to a
    >specific X,Y coordinate... I'm pretty sure that the window.screenX and
    >window.screenY properties are the answer, but I'm having very little success
    >in making this all work in both IE and NS.
    >
    >Here's my code as it stands today:
    >
    >function windowOpen3(URL, windowW, windowH) {
    > strWindow =
    >'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,re
    >sizable=0,size=yes,width=' + windowW + ',height=' + windowH +
    >'screenX=100,screenY=100'
    > window.open(URL,'hwWindow',strWindow)
    >}
    >
    >IE is ignoring the X,Y coordinates completely and opening the new window so
    >far over to the right that half of it is off-screen and NS is picking up the
    >screenY setting but ignoring screenX.
    >
    >Am I missing something here? Please help, and TIA.


    You're missing a comma before "screenX".
    You've invented an attribute named "size".
    IE ignores screenX and screenY, expecting left and top, instead.
    You don't need to list attributes that are set to "no", since that
    is the default if you specify values for any other attributes:

    function windowOpen3(URL, windowW, windowH) {
    strWindow = 'width=' + windowW + ',height=' + windowH
    + ',screenX=100,screenY=100,top=100,left=100';
    window.open(URL,'hwWindow',strWindow);
    }
     
    Lee, Jan 6, 2004
    #3
  4. Matt Stanley

    Matt Stanley Guest

    Thanks so much for your help! That TOTALLY worked. It's always nice when
    developers help each other; you guys both just made my day!

    "Lasse Reichstein Nielsen" <> wrote in message
    news:...
    > "Matt Stanley" <> writes:
    >
    > >

    'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,re
    > > sizable=0,size=yes,width=' + windowW + ',height=' + windowH +
    > > 'screenX=100,screenY=100'

    > ...
    > > IE is ignoring the X,Y coordinates completely

    >
    > Yep. They never claimed to understand it.
    >

    <URL:http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_
    0.asp>
    >
    > > NS is picking up the screenY setting but ignoring screenX.

    >
    > Missing "," before "screenX".
    >
    > > Am I missing something here? Please help, and TIA.

    >
    > I recommend using "left" and "top" instead of "screenX" and "screenY".
    > These properties seem to work in all browsers since Netscape 4 (do tell
    > me if you find exceptions :)
    > <URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_2>
    >
    > While it is not documented by Netscape, "left" and "top" it seems to
    > be supported from (at least) Netscape 4.08.
    >

    (<URL:http://devedge.netscape.com/library/manuals/2000/javascript/1.3/refere
    nce/window.html#1202731>)
    > I doesn't work in Netscape 3, but that's not really a problem any more.
    >
    > Actually, I recommend aginst trying to position windows at all. In MDI
    > browsers or dual-monitor displays, it can be quite disruptive, and in

    other
    > browsers, it's usually not needed.
    > <URL:http://www.infimum.dk/HTML/JSwindows.html#ref_3_3>
    >
    > /L
    > --
    > Lasse Reichstein Nielsen -
    > DHTML Death Colors:

    <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
    > 'Faith without judgement merely degrades the spirit divine.'
     
    Matt Stanley, Jan 6, 2004
    #4
  5. Matt Stanley

    Matt Stanley Guest

    Thanks so much for your help! That TOTALLY worked. It's always nice when
    developers help each other; you guys both just made my day!

    "Lee" <> wrote in message
    news:...
    > Matt Stanley said:
    > >
    > >I'm trying to use a popup window script that opens the new window to a
    > >specific X,Y coordinate... I'm pretty sure that the window.screenX and
    > >window.screenY properties are the answer, but I'm having very little

    success
    > >in making this all work in both IE and NS.
    > >
    > >Here's my code as it stands today:
    > >
    > >function windowOpen3(URL, windowW, windowH) {
    > > strWindow =

    >
    >'toolbar=no,status=no,scrollbars=no,location=no,menubar=no,directories=no,r

    e
    > >sizable=0,size=yes,width=' + windowW + ',height=' + windowH +
    > >'screenX=100,screenY=100'
    > > window.open(URL,'hwWindow',strWindow)
    > >}
    > >
    > >IE is ignoring the X,Y coordinates completely and opening the new window

    so
    > >far over to the right that half of it is off-screen and NS is picking up

    the
    > >screenY setting but ignoring screenX.
    > >
    > >Am I missing something here? Please help, and TIA.

    >
    > You're missing a comma before "screenX".
    > You've invented an attribute named "size".
    > IE ignores screenX and screenY, expecting left and top, instead.
    > You don't need to list attributes that are set to "no", since that
    > is the default if you specify values for any other attributes:
    >
    > function windowOpen3(URL, windowW, windowH) {
    > strWindow = 'width=' + windowW + ',height=' + windowH
    > + ',screenX=100,screenY=100,top=100,left=100';
    > window.open(URL,'hwWindow',strWindow);
    > }
    >
     
    Matt Stanley, Jan 6, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Powell
    Replies:
    0
    Views:
    1,211
    Aaron Powell
    Jul 24, 2003
  2. Jasper
    Replies:
    0
    Views:
    500
    Jasper
    Jun 28, 2004
  3. MSFT
    Replies:
    11
    Views:
    598
    Grimsa
    Dec 3, 2003
  4. Guest
    Replies:
    1
    Views:
    368
    Guest
    Aug 24, 2006
  5. BoBi
    Replies:
    3
    Views:
    138
Loading...

Share This Page