vertical scrolling in a newly created window

Discussion in 'Javascript' started by yootzee, Oct 16, 2003.

  1. yootzee

    yootzee Guest

    Greetings all,

    I'm having a problem with scrolling vertically in a newly created
    browser
    window. The vertical scrolling is to reach some anchor point within
    the new
    browser window.

    I'm attempting to do this by using an anchor point name of an anchor
    located
    in the new page as an argument to the JS function opening the new
    browser
    window. Here's exactly how I'm trying to go about it.

    * PageA contains a hyperlink with an onclick event to open a new
    page...PageB:
    <a href="#" onclick="openPageB( 'someAnchorPoint' ); return false">
    where "someAnchorPoint" is the name of an anchor in PageB.

    * The JS that I'm using is:
    function openPageB( someAnchor )
    {
    var oNewWin = window.open("/PageB.html", "Help", "width=400,
    height=350,
    status=no, scrollbars=yes, resizable=yes");
    oNewWin.onLoad = window.scrollTo(0, document.anchors[someAnchor]);
    oNewWin.focus();
    }

    My reasoning is based on by belief that document.anchors will return
    an integer value based on the geographic location of some given named
    anchor within the document object.

    What's happening now is that a new browser window is created fine, but
    just
    can't get the scroll to work; always starts at position 0,0.

    Any suggestions are greatly appreciated, and thanks in advance,
    yootzee
    yootzee, Oct 16, 2003
    #1
    1. Advertising

  2. (yootzee) writes:

    > * The JS that I'm using is:
    > function openPageB( someAnchor )
    > {
    > var oNewWin = window.open("/PageB.html", "Help", "width=400,
    > height=350,
    > status=no, scrollbars=yes, resizable=yes");


    Why not just

    var oNewWin = window.open("/PageB.html#"+someAncyhor, "Help", ...

    > oNewWin.onLoad = window.scrollTo(0, document.anchors[someAnchor]);


    I don't know if this will work, but in any case "onload" is with all
    small letters.

    > My reasoning is based on by belief that document.anchors will return
    > an integer value based on the geographic location of some given named
    > anchor within the document object.


    .... and that is an unfounded belief.

    The collection "document.anchors" contains HTML elements (i.e., DOM
    nodes). It is browser dependent how to find the horizontal offset of
    the element on the page. Methods include:

    elem.offsetLeft // IE, Opera, Mozilla,
    // but not inside positioned elements
    elem.scrollLeft // Opera (bug?)
    elem.x // Netscape 4

    /L
    --
    Lasse Reichstein Nielsen -
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
    'Faith without judgement merely degrades the spirit divine.'
    Lasse Reichstein Nielsen, Oct 16, 2003
    #2
    1. Advertising

  3. yootzee

    yootzee Guest

    Thanks Lasse, originally, I was using concatination
    ("PageB.html#"+someAnchor), and it wasn't working. so, my still being
    a little young and naive with JS, I just figured window.open didn't
    like that. but, after scrutinizing my scripting, I realized that it
    was a PEBCAK error. thanks again for the help. yootzee

    Lasse Reichstein Nielsen <> wrote in message news:<>...
    > (yootzee) writes:
    >
    > > * The JS that I'm using is:
    > > function openPageB( someAnchor )
    > > {
    > > var oNewWin = window.open("/PageB.html", "Help", "width=400,
    > > height=350,
    > > status=no, scrollbars=yes, resizable=yes");

    >
    > Why not just
    >
    > var oNewWin = window.open("/PageB.html#"+someAncyhor, "Help", ...
    >
    > > oNewWin.onLoad = window.scrollTo(0, document.anchors[someAnchor]);

    >
    > I don't know if this will work, but in any case "onload" is with all
    > small letters.
    >
    > > My reasoning is based on by belief that document.anchors will return
    > > an integer value based on the geographic location of some given named
    > > anchor within the document object.

    >
    > ... and that is an unfounded belief.
    >
    > The collection "document.anchors" contains HTML elements (i.e., DOM
    > nodes). It is browser dependent how to find the horizontal offset of
    > the element on the page. Methods include:
    >
    > elem.offsetLeft // IE, Opera, Mozilla,
    > // but not inside positioned elements
    > elem.scrollLeft // Opera (bug?)
    > elem.x // Netscape 4
    >
    > /L
    yootzee, Oct 16, 2003
    #3
    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. Earl Teigrob
    Replies:
    0
    Views:
    328
    Earl Teigrob
    Aug 5, 2003
  2. David Lozzi

    Get newly created record's ID??

    David Lozzi, Dec 7, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    401
    Jacco Schalkwijk
    Dec 7, 2004
  3. =?Utf-8?B?bWN3b29x?=

    Error Debubbing newly created ASP.NET Project

    =?Utf-8?B?bWN3b29x?=, Nov 11, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    2,336
    Steven Cheng[MSFT]
    Nov 15, 2005
  4. Replies:
    1
    Views:
    551
    John Timney \( MVP \)
    May 31, 2006
  5. Edward Lorden

    HTTP 403 error on a newly created web site

    Edward Lorden, Jun 2, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    8,916
    Edward Lorden
    Jun 2, 2006
Loading...

Share This Page