vertical scrolling in a newly created window

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • yootzee

    vertical scrolling in a newly created window

    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="openPa geB( 'someAnchorPoin t' ); return false">
    where "someAnchorPoin t" 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.anchor s[someAnchor]);
    oNewWin.focus() ;
    }

    My reasoning is based on by belief that document.anchor s 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
  • Lasse Reichstein Nielsen

    #2
    Re: vertical scrolling in a newly created window

    yootzee@hotmail .com (yootzee) writes:
    [color=blue]
    > * 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") ;[/color]

    Why not just

    var oNewWin = window.open("/PageB.html#"+so meAncyhor, "Help", ...
    [color=blue]
    > oNewWin.onLoad = window.scrollTo (0, document.anchor s[someAnchor]);[/color]

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

    .... and that is an unfounded belief.

    The collection "document.ancho rs" 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 - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • yootzee

      #3
      Re: vertical scrolling in a newly created window

      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 <lrn@hotpop.com > wrote in message news:<ekxdqwxv. fsf@hotpop.com> ...[color=blue]
      > yootzee@hotmail .com (yootzee) writes:
      >[color=green]
      > > * 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") ;[/color]
      >
      > Why not just
      >
      > var oNewWin = window.open("/PageB.html#"+so meAncyhor, "Help", ...
      >[color=green]
      > > oNewWin.onLoad = window.scrollTo (0, document.anchor s[someAnchor]);[/color]
      >
      > I don't know if this will work, but in any case "onload" is with all
      > small letters.
      >[color=green]
      > > My reasoning is based on by belief that document.anchor s will return
      > > an integer value based on the geographic location of some given named
      > > anchor within the document object.[/color]
      >
      > ... and that is an unfounded belief.
      >
      > The collection "document.ancho rs" 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[/color]

      Comment

      Working...