onload event... question

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

    #1

    onload event... question

    Hi,
    I have a file with table with anchors buried in each row. In the body
    tag I have

    <body onload=highligh t()>

    I jump to this file with links from another window like:

    <a href=file.htm#r ow200 target='src'> Row200 </a>
    <a href=file.htm#r ow500 target='src'> Row500 </a>

    If I hit the jump 'ROW200', my browser will open a (src) window and
    scroll to the line with the anchor 'row200' and my javascript routine
    'highlight()' will parse the location.hash value and highlight the row
    as expected.

    If I now hit another link such as 'ROW500', to the same file but with a
    different hash value, (the window is already open and loaded), the
    window will scroll to the proper anchor location, but there is no
    'onload' event fired, and therefore the line is not highlighted.

    My question, is there an event that I can capture that indicates the
    location.hash value has been changed so I can highlight the new row?

    I have tried capturing the onscroll event, but that is not fired
    either.
    I have been developing with Mozilla, but need to support IE as well..

    Any ideas??
    Thanks
    pip

  • Paul R

    #2
    Re: onload event... question

    pipjockey wrote:
    [color=blue]
    > I jump to this file with links from another window like:
    >
    > <a href=file.htm#r ow200 target='src'> Row200 </a>
    > <a href=file.htm#r ow500 target='src'> Row500 </a>
    >
    > If I hit the jump 'ROW200', my browser will open a (src) window and
    > scroll to the line with the anchor 'row200' and my javascript routine
    > 'highlight()' will parse the location.hash value and highlight the row
    > as expected.
    >
    > If I now hit another link such as 'ROW500', to the same file but with a
    > different hash value, (the window is already open and loaded), the
    > window will scroll to the proper anchor location, but there is no
    > 'onload' event fired, and therefore the line is not highlighted.[/color]

    One solution is to put the parameter in the query string of the URL, as
    well as the hash:

    <a href='file.htm? row=200#row200' target='src'>

    The browser will treat any change to the query as a whole new URL and
    fire the onload event.

    Comment

    • pipjockey

      #3
      Re: onload event... question

      Paul R wrote:
      [color=blue]
      > One solution is to put the parameter in the query string of the URL,[/color]
      as[color=blue]
      > well as the hash:
      >
      > <a href='file.htm? row=200#row200' target='src'>
      >
      > The browser will treat any change to the query as a whole new URL and[/color]
      [color=blue]
      > fire the onload event.[/color]

      Thanks Paul, unfortunately, these are rather large tables and that
      causes the whole file to be loaded again. I got around it by
      maintaining a link to the child window and calling the child hightlight
      function directly from the parent window. I was hoping to use a
      'standard' linkage rather than creating my own, but....

      pip

      Comment

      Working...